mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch '2.0' into 2.1
Conflicts: lib/Cake/VERSION.txt
This commit is contained in:
commit
92d028630c
288 changed files with 3937 additions and 2441 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,5 +1,6 @@
|
|||
/app/Config
|
||||
/app/tmp
|
||||
/lib/Cake/Console/Templates/skel/tmp/
|
||||
/plugins
|
||||
/vendors
|
||||
.DS_Store
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
/*DbAcl schema generated on: 2007-11-24 15:11:13 : 1195945453*/
|
||||
|
||||
/**
|
||||
* This is Acl Schema file
|
||||
*
|
||||
|
@ -15,10 +16,11 @@
|
|||
*
|
||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package app.config.sql
|
||||
* @package app.Config.Schema
|
||||
* @since CakePHP(tm) v 0.2.9
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* Using the Schema command line utility
|
||||
|
@ -27,6 +29,15 @@
|
|||
*/
|
||||
class DbAclSchema extends CakeSchema {
|
||||
|
||||
public $name = 'DbAcl';
|
||||
|
||||
public function before($event = array()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function after($event = array()) {
|
||||
}
|
||||
|
||||
public $acos = array(
|
||||
'id' => array('type'=>'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
|
||||
'parent_id' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
/*i18n schema generated on: 2007-11-25 07:11:25 : 1196004805*/
|
||||
|
||||
/**
|
||||
* This is i18n Schema file
|
||||
*
|
||||
|
@ -15,10 +16,11 @@
|
|||
*
|
||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package app.config.sql
|
||||
* @package app.Config.Schema
|
||||
* @since CakePHP(tm) v 0.2.9
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* Using the Schema command line utility
|
||||
|
@ -27,6 +29,15 @@
|
|||
*/
|
||||
class i18nSchema extends CakeSchema {
|
||||
|
||||
public $name = 'i18n';
|
||||
|
||||
public function before($event = array()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function after($event = array()) {
|
||||
}
|
||||
|
||||
public $i18n = array(
|
||||
'id' => array('type'=>'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
|
||||
'locale' => array('type'=>'string', 'null' => false, 'length' => 6, 'key' => 'index'),
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
/*Sessions schema generated on: 2007-11-25 07:11:54 : 1196004714*/
|
||||
|
||||
/**
|
||||
* This is Sessions Schema file
|
||||
*
|
||||
|
@ -15,10 +16,11 @@
|
|||
*
|
||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package app.config.sql
|
||||
* @package app.Config.Schema
|
||||
* @since CakePHP(tm) v 0.2.9
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* Using the Schema command line utility
|
||||
|
@ -27,6 +29,15 @@
|
|||
*/
|
||||
class SessionsSchema extends CakeSchema {
|
||||
|
||||
public $name = 'Sessions';
|
||||
|
||||
public function before($event = array()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function after($event = array()) {
|
||||
}
|
||||
|
||||
public $cake_sessions = array(
|
||||
'id' => array('type'=>'string', 'null' => false, 'key' => 'primary'),
|
||||
'data' => array('type'=>'text', 'null' => true, 'default' => NULL),
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
;<?php exit() ?>
|
||||
; SVN FILE: $Id$
|
||||
;/**
|
||||
; * ACL Configuration
|
||||
; *
|
||||
; *
|
||||
; * PHP 5
|
||||
; *
|
||||
; * CakePHP(tm) : Rapid Development Framework http://cakephp.org
|
||||
; * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
; * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
; *
|
||||
; * Licensed under The MIT License
|
||||
|
@ -14,7 +13,7 @@
|
|||
; *
|
||||
; * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
; * @link http://cakephp.org CakePHP(tm) Project
|
||||
; * @package app.config
|
||||
; * @package app.Config
|
||||
; * @since CakePHP(tm) v 0.10.0.1076
|
||||
; * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
; */
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*
|
||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package app.config
|
||||
* @package app.Config
|
||||
* @since CakePHP(tm) v 0.10.8.2117
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
@ -30,16 +30,16 @@ Cache::config('default', array('engine' => 'File'));
|
|||
* The settings below can be used to set additional paths to models, views and controllers.
|
||||
*
|
||||
* App::build(array(
|
||||
* 'plugins' => array('/full/path/to/plugins/', '/next/full/path/to/plugins/'),
|
||||
* 'models' => array('/full/path/to/models/', '/next/full/path/to/models/'),
|
||||
* 'views' => array('/full/path/to/views/', '/next/full/path/to/views/'),
|
||||
* 'controllers' => array('/full/path/to/controllers/', '/next/full/path/to/controllers/'),
|
||||
* 'datasources' => array('/full/path/to/datasources/', '/next/full/path/to/datasources/'),
|
||||
* 'behaviors' => array('/full/path/to/behaviors/', '/next/full/path/to/behaviors/'),
|
||||
* 'components' => array('/full/path/to/components/', '/next/full/path/to/components/'),
|
||||
* 'helpers' => array('/full/path/to/helpers/', '/next/full/path/to/helpers/'),
|
||||
* 'vendors' => array('/full/path/to/vendors/', '/next/full/path/to/vendors/'),
|
||||
* 'shells' => array('/full/path/to/shells/', '/next/full/path/to/shells/'),
|
||||
* 'Plugin' => array('/full/path/to/plugins/', '/next/full/path/to/plugins/'),
|
||||
* 'Model' => array('/full/path/to/models/', '/next/full/path/to/models/'),
|
||||
* 'View' => array('/full/path/to/views/', '/next/full/path/to/views/'),
|
||||
* 'Controller' => array('/full/path/to/controllers/', '/next/full/path/to/controllers/'),
|
||||
* 'Model/Datasource' => array('/full/path/to/datasources/', '/next/full/path/to/datasources/'),
|
||||
* 'Model/Behavior' => array('/full/path/to/behaviors/', '/next/full/path/to/behaviors/'),
|
||||
* 'Controller/Component' => array('/full/path/to/components/', '/next/full/path/to/components/'),
|
||||
* 'View/Helper' => array('/full/path/to/helpers/', '/next/full/path/to/helpers/'),
|
||||
* 'Vendor' => array('/full/path/to/vendors/', '/next/full/path/to/vendors/'),
|
||||
* 'Console/Command' => array('/full/path/to/shells/', '/next/full/path/to/shells/'),
|
||||
* 'locales' => array('/full/path/to/locale/', '/next/full/path/to/locale/')
|
||||
* ));
|
||||
*
|
||||
|
@ -62,4 +62,4 @@ Cache::config('default', array('engine' => 'File'));
|
|||
* CakePlugin::loadAll(); // Loads all plugins at once
|
||||
* CakePlugin::load('DebugKit'); //Loads a single plugin named DebugKit
|
||||
*
|
||||
*/
|
||||
*/
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*
|
||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package app.config
|
||||
* @package app.Config
|
||||
* @since CakePHP(tm) v 0.2.9
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*
|
||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package app.config
|
||||
* @package app.Config
|
||||
* @since CakePHP(tm) v 0.2.9
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
@ -54,6 +54,8 @@
|
|||
* For MySQL, Postgres specifies the character encoding to use when connecting to the
|
||||
* database. Uses database default not specified.
|
||||
*
|
||||
* unix_socket =>
|
||||
* For MySQL to connect via socket specify the `unix_socket` parameter instead of `host` and `port`
|
||||
*/
|
||||
class DATABASE_CONFIG {
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*
|
||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package app.config
|
||||
* @package app.Config
|
||||
* @since CakePHP(tm) v 2.0.0
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
@ -30,6 +30,7 @@
|
|||
* transport => The name of a supported transport; valid options are as follows:
|
||||
* Mail - Send using PHP mail function
|
||||
* Smtp - Send using SMTP
|
||||
* Debug - Do not send the email, just return the result
|
||||
*
|
||||
* You can add custom transports (or override existing transports) by adding the
|
||||
* appropriate file to app/Network/Email. Transports should be named 'YourTransport.php',
|
||||
|
@ -43,18 +44,23 @@ class EmailConfig {
|
|||
|
||||
public $default = array(
|
||||
'transport' => 'Mail',
|
||||
'from' => 'you@localhost'
|
||||
'from' => 'you@localhost',
|
||||
//'charset' => 'utf-8',
|
||||
//'headerCharset' => 'utf-8',
|
||||
);
|
||||
|
||||
public $smtp = array(
|
||||
'transport' => 'Smtp',
|
||||
'from' => array('My Site', 'site@localhost'),
|
||||
'from' => array('site@localhost' => 'My Site'),
|
||||
'host' => 'localhost',
|
||||
'port' => 25,
|
||||
'timeout' => 30,
|
||||
'username' => 'user',
|
||||
'password' => 'secret',
|
||||
'client' => null
|
||||
'client' => null,
|
||||
'log' => false
|
||||
//'charset' => 'utf-8',
|
||||
//'headerCharset' => 'utf-8',
|
||||
);
|
||||
|
||||
public $fast = array(
|
||||
|
@ -82,7 +88,10 @@ class EmailConfig {
|
|||
'timeout' => 30,
|
||||
'username' => 'user',
|
||||
'password' => 'secret',
|
||||
'client' => null
|
||||
'client' => null,
|
||||
'log' => true,
|
||||
//'charset' => 'utf-8',
|
||||
//'headerCharset' => 'utf-8',
|
||||
);
|
||||
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package app.config
|
||||
* @package app.Config
|
||||
* @since CakePHP(tm) v 0.2.9
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
|
|
@ -11,15 +11,23 @@
|
|||
# Redistributions of files must retain the above copyright notice.
|
||||
#
|
||||
# @copyright Copyright 2005-2011, Cake Software Foundation, Inc.
|
||||
# @link http://cakephp.org CakePHP(tm) Project
|
||||
# @package app.console
|
||||
# @since CakePHP(tm) v 2.0
|
||||
# @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
# @link http://cakephp.org CakePHP(tm) Project
|
||||
# @package app.Console
|
||||
# @since CakePHP(tm) v 2.0
|
||||
# @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
#
|
||||
################################################################################
|
||||
LIB=${0/%cake/}
|
||||
LIB=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && LIB=$LIB/$(basename -- "$0")
|
||||
|
||||
while [ -h "$LIB" ]; do
|
||||
DIR=$(dirname -- "$LIB")
|
||||
SYM=$(readlink "$LIB")
|
||||
LIB=$(cd "$DIR" && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
|
||||
done
|
||||
|
||||
LIB=$(dirname -- "$LIB")/
|
||||
APP=`pwd`
|
||||
|
||||
exec php -q ${LIB}cake.php -working "${APP}" "$@"
|
||||
exec php -q "$LIB"cake.php -working "$APP" "$@"
|
||||
|
||||
exit;
|
||||
exit;
|
||||
|
|
|
@ -1,32 +1,32 @@
|
|||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
::
|
||||
:: Bake is a shell script for running CakePHP bake script
|
||||
:: PHP 5
|
||||
::
|
||||
:: CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
:: Copyright 2005-2011, Cake Software Foundation, Inc.
|
||||
::
|
||||
:: Licensed under The MIT License
|
||||
:: Redistributions of files must retain the above copyright notice.
|
||||
::
|
||||
:: @copyright Copyright 2005-2011, Cake Software Foundation, Inc.
|
||||
:: @link http://cakephp.org CakePHP(tm) Project
|
||||
:: @package app.console
|
||||
:: @since CakePHP(tm) v 2.0
|
||||
:: @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
::
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
|
||||
:: In order for this script to work as intended, the cake\console\ folder must be in your PATH
|
||||
|
||||
@echo.
|
||||
@echo off
|
||||
|
||||
SET app=%0
|
||||
SET lib=%~dp0
|
||||
|
||||
php -q "%lib%cake.php" -working "%CD% " %*
|
||||
|
||||
echo.
|
||||
|
||||
exit /B %ERRORLEVEL%
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
::
|
||||
:: Bake is a shell script for running CakePHP bake script
|
||||
:: PHP 5
|
||||
::
|
||||
:: CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
:: Copyright 2005-2011, Cake Software Foundation, Inc.
|
||||
::
|
||||
:: Licensed under The MIT License
|
||||
:: Redistributions of files must retain the above copyright notice.
|
||||
::
|
||||
:: @copyright Copyright 2005-2011, Cake Software Foundation, Inc.
|
||||
:: @link http://cakephp.org CakePHP(tm) Project
|
||||
:: @package app.Console
|
||||
:: @since CakePHP(tm) v 2.0
|
||||
:: @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
::
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
|
||||
:: In order for this script to work as intended, the cake\console\ folder must be in your PATH
|
||||
|
||||
@echo.
|
||||
@echo off
|
||||
|
||||
SET app=%0
|
||||
SET lib=%~dp0
|
||||
|
||||
php -q "%lib%cake.php" -working "%CD% " %*
|
||||
|
||||
echo.
|
||||
|
||||
exit /B %ERRORLEVEL%
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
|
||||
</IfModule>
|
||||
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
|
||||
</IfModule>
|
||||
|
|
|
@ -354,6 +354,7 @@ input[type=submit] {
|
|||
}
|
||||
form .submit input[type=submit] {
|
||||
background:#62af56;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#76BF6B), to(#3B8230));
|
||||
background-image: -webkit-linear-gradient(top, #76BF6B, #3B8230);
|
||||
background-image: -moz-linear-gradient(top, #76BF6B, #3B8230);
|
||||
border-color: #2d6324;
|
||||
|
@ -414,6 +415,7 @@ p.error,
|
|||
background-repeat: repeat-x;
|
||||
background-image: -moz-linear-gradient(top, #ffcc00, #E6B800);
|
||||
background-image: -ms-linear-gradient(top, #ffcc00, #E6B800);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#ffcc00), to(#E6B800));
|
||||
background-image: -webkit-linear-gradient(top, #ffcc00, #E6B800);
|
||||
background-image: -o-linear-gradient(top, #ffcc00, #E6B800);
|
||||
background-image: linear-gradient(top, #ffcc00, #E6B800);
|
||||
|
@ -442,6 +444,7 @@ p.error,
|
|||
background-repeat: repeat-x;
|
||||
background-image: -moz-linear-gradient(top, #ee5f5b, #c43c35);
|
||||
background-image: -ms-linear-gradient(top, #ee5f5b, #c43c35);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#ee5f5b), to(#c43c35));
|
||||
background-image: -webkit-linear-gradient(top, #ee5f5b, #c43c35);
|
||||
background-image: -o-linear-gradient(top, #ee5f5b, #c43c35);
|
||||
background-image: linear-gradient(top, #ee5f5b, #c43c35);
|
||||
|
@ -453,6 +456,7 @@ p.error,
|
|||
border: 1px solid rgba(0, 0, 0, 0.5);
|
||||
background: #3B8230;
|
||||
background-repeat: repeat-x;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#76BF6B), to(#3B8230));
|
||||
background-image: -webkit-linear-gradient(top, #76BF6B, #3B8230);
|
||||
background-image: -moz-linear-gradient(top, #76BF6B, #3B8230);
|
||||
background-image: -ms-linear-gradient(top, #76BF6B, #3B8230);
|
||||
|
@ -505,6 +509,7 @@ input[type=submit],
|
|||
font-weight:normal;
|
||||
padding: 4px 8px;
|
||||
background: #dcdcdc;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#fefefe), to(#dcdcdc));
|
||||
background-image: -webkit-linear-gradient(top, #fefefe, #dcdcdc);
|
||||
background-image: -moz-linear-gradient(top, #fefefe, #dcdcdc);
|
||||
background-image: -ms-linear-gradient(top, #fefefe, #dcdcdc);
|
||||
|
@ -534,6 +539,7 @@ input[type=submit]:active,
|
|||
.actions ul li a:active,
|
||||
.actions a:active {
|
||||
background: #eee;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#dfdfdf), to(#eee));
|
||||
background-image: -webkit-linear-gradient(top, #dfdfdf, #eee);
|
||||
background-image: -moz-linear-gradient(top, #dfdfdf, #eee);
|
||||
background-image: -ms-linear-gradient(top, #dfdfdf, #eee);
|
||||
|
|
|
@ -84,7 +84,7 @@ if (!empty($failed)) {
|
|||
}
|
||||
|
||||
if (Configure::read('debug') < 1) {
|
||||
die(__d('cake', 'Debug setting does not allow access to this url.'));
|
||||
die(__d('cake_dev', 'Debug setting does not allow access to this url.'));
|
||||
}
|
||||
|
||||
require_once CAKE . 'TestSuite' . DS . 'CakeTestSuiteDispatcher.php';
|
||||
|
|
|
@ -66,8 +66,8 @@ class FileEngine extends CacheEngine {
|
|||
public function init($settings = array()) {
|
||||
parent::init(array_merge(
|
||||
array(
|
||||
'engine' => 'File', 'path' => CACHE, 'prefix'=> 'cake_', 'lock'=> false,
|
||||
'serialize'=> true, 'isWindows' => false
|
||||
'engine' => 'File', 'path' => CACHE, 'prefix'=> 'cake_', 'lock'=> true,
|
||||
'serialize'=> true, 'isWindows' => false, 'mask' => 0664
|
||||
),
|
||||
$settings
|
||||
));
|
||||
|
@ -124,21 +124,16 @@ class FileEngine extends CacheEngine {
|
|||
$expires = time() + $duration;
|
||||
$contents = $expires . $lineBreak . $data . $lineBreak;
|
||||
|
||||
if (!$handle = fopen($this->_File->getPathName(), 'c')) {
|
||||
return false;
|
||||
if ($this->settings['lock']) {
|
||||
$this->_File->flock(LOCK_EX);
|
||||
}
|
||||
|
||||
$success = $this->_File->ftruncate(0) && $this->_File->fwrite($contents) && $this->_File->fflush();
|
||||
|
||||
if ($this->settings['lock']) {
|
||||
flock($handle, LOCK_EX);
|
||||
$this->_File->flock(LOCK_UN);
|
||||
}
|
||||
|
||||
$success = ftruncate($handle, 0) && fwrite($handle, $contents) && fflush($handle);
|
||||
|
||||
if ($this->settings['lock']) {
|
||||
flock($handle, LOCK_UN);
|
||||
}
|
||||
|
||||
fclose($handle);
|
||||
return $success;
|
||||
}
|
||||
|
||||
|
@ -162,6 +157,9 @@ class FileEngine extends CacheEngine {
|
|||
$cachetime = intval($this->_File->current());
|
||||
|
||||
if ($cachetime !== false && ($cachetime < $time || ($time + $this->settings['duration']) < $cachetime)) {
|
||||
if ($this->settings['lock']) {
|
||||
$this->_File->flock(LOCK_UN);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -273,7 +271,8 @@ class FileEngine extends CacheEngine {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the current cache key this class is managing
|
||||
* Sets the current cache key this class is managing, and creates a writable SplFileObject
|
||||
* for the cache file the key is refering to.
|
||||
*
|
||||
* @param string $key The key
|
||||
* @param boolean $createKey Whether the key should be created if it doesn't exists, or not
|
||||
|
@ -285,12 +284,22 @@ class FileEngine extends CacheEngine {
|
|||
if (!$createKey && !$path->isFile()) {
|
||||
return false;
|
||||
}
|
||||
$old = umask(0);
|
||||
if (empty($this->_File) || $this->_File->getBaseName() !== $key) {
|
||||
$this->_File = $path->openFile('a+');
|
||||
}
|
||||
umask($old);
|
||||
$exists = file_exists($path->getPathname());
|
||||
try {
|
||||
$this->_File = $path->openFile('c+');
|
||||
} catch (Exception $e) {
|
||||
trigger_error($e->getMessage(), E_USER_WARNING);
|
||||
return false;
|
||||
}
|
||||
unset($path);
|
||||
|
||||
if (!$exists && !chmod($this->_File->getPathname(), (int) $this->settings['mask'])) {
|
||||
trigger_error(__d(
|
||||
'cake_dev', 'Could not apply permission mask "%s" on cache file "%s"',
|
||||
array($this->_File->getPathname(), $this->settings['mask'])), E_USER_WARNING);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -89,12 +89,15 @@ class MemcacheEngine extends CacheEngine {
|
|||
|
||||
/**
|
||||
* Parses the server address into the host/port. Handles both IPv6 and IPv4
|
||||
* addresses
|
||||
* addresses and Unix sockets
|
||||
*
|
||||
* @param string $server The server address string.
|
||||
* @return array Array containing host, port
|
||||
*/
|
||||
protected function _parseServerString($server) {
|
||||
if ($server[0] == 'u') {
|
||||
return array($server, 0);
|
||||
}
|
||||
if (substr($server, 0, 1) == '[') {
|
||||
$position = strpos($server, ']:');
|
||||
if ($position !== false) {
|
||||
|
|
|
@ -16,4 +16,4 @@
|
|||
* @since CakePHP(tm) v 1.1.11.4062
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
return $config['Cake.version'] = '2.0.0-RC1';
|
||||
return $config['Cake.version'] = '2.0.0';
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
* Redistributions of files must retain the above copyright notice
|
||||
*
|
||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/2.0/en/development/configuration.html#loading-configuration-files CakePHP(tm) Configuration
|
||||
* @package Cake.Configure
|
||||
* @since CakePHP(tm) v 2.0
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
|
@ -72,10 +72,10 @@ class PhpReader implements ConfigReaderInterface {
|
|||
} else {
|
||||
$file = $this->_path . $key;
|
||||
}
|
||||
if (!file_exists($file)) {
|
||||
$file .= '.php';
|
||||
if (!file_exists($file)) {
|
||||
throw new ConfigureException(__d('cake_dev', 'Could not load configuration files: %s or %s', substr($file, 0, -4), $file));
|
||||
$file .= '.php';
|
||||
if (!is_file($file)) {
|
||||
if (!is_file(substr($file, 0, -4))) {
|
||||
throw new ConfigureException(__d('cake_dev', 'Could not load configuration files: %s or %s', $file, substr($file, 0, -4)));
|
||||
}
|
||||
}
|
||||
include $file;
|
||||
|
|
|
@ -427,7 +427,7 @@ class AclShell extends Shell {
|
|||
'help' => __d('cake_console', 'Check the permissions between an ACO and ARO.'),
|
||||
'parser' => array(
|
||||
'description' => array(
|
||||
__d('cake_console', 'Use this command to grant ACL permissions. Once executed, the ARO specified (and its children, if any) will have ALLOW access to the specified ACO action (and the ACO\'s children, if any).')
|
||||
__d('cake_console', 'Use this command to check ACL permissions.')
|
||||
),
|
||||
'arguments' => array(
|
||||
'aro' => array('help' => __d('cake_console', 'ARO to check.'), 'required' => true),
|
||||
|
|
|
@ -26,7 +26,7 @@ App::uses('Model', 'Model');
|
|||
* Bake is a command-line code generation utility for automating programmer chores.
|
||||
*
|
||||
* @package Cake.Console.Command
|
||||
* @link http://book.cakephp.org/view/1522/Code-Generation-with-Bake
|
||||
* @link http://book.cakephp.org/2.0/en/console-and-shells/code-generation-with-bake.html
|
||||
*/
|
||||
class BakeShell extends Shell {
|
||||
|
||||
|
@ -51,6 +51,9 @@ class BakeShell extends Shell {
|
|||
*/
|
||||
public function startup() {
|
||||
parent::startup();
|
||||
Configure::write('debug', 2);
|
||||
Configure::write('Cache.disable', 1);
|
||||
|
||||
$task = Inflector::classify($this->command);
|
||||
if (isset($this->{$task}) && !in_array($task, array('Project', 'DbConfig'))) {
|
||||
if (isset($this->params['connection'])) {
|
||||
|
@ -65,8 +68,6 @@ class BakeShell extends Shell {
|
|||
* @return mixed
|
||||
*/
|
||||
public function main() {
|
||||
Configure::write('Cache.disable', 1);
|
||||
|
||||
if (!is_dir($this->DbConfig->path)) {
|
||||
$path = $this->Project->execute();
|
||||
if (!empty($path)) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* CommandListTest file
|
||||
* Command list Shell
|
||||
*
|
||||
* PHP 5
|
||||
*
|
||||
|
|
|
@ -26,7 +26,7 @@ App::uses('CakeSchema', 'Model');
|
|||
* Schema is a command-line database management utility for automating programmer chores.
|
||||
*
|
||||
* @package Cake.Console.Command
|
||||
* @link http://book.cakephp.org/view/1523/Schema-management-and-migrations
|
||||
* @link http://book.cakephp.org/2.0/en/console-and-shells/schema-management-and-migrations.html
|
||||
*/
|
||||
class SchemaShell extends Shell {
|
||||
|
||||
|
@ -428,7 +428,7 @@ class SchemaShell extends Shell {
|
|||
$Schema->after(array($event => $table, 'errors' => $error));
|
||||
|
||||
if (!empty($error)) {
|
||||
$this->out($error);
|
||||
$this->err($error);
|
||||
} else {
|
||||
$this->out(__d('cake_console', '%s updated.', $table));
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
* @since CakePHP(tm) v 1.3
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
||||
App::uses('Shell', 'Console');
|
||||
/**
|
||||
* Base class for Bake Tasks.
|
||||
*
|
||||
|
@ -44,12 +46,13 @@ class BakeTask extends Shell {
|
|||
public $interactive = false;
|
||||
|
||||
/**
|
||||
* Disable caching for baking.
|
||||
* Disable caching and enable debug for baking.
|
||||
* This forces the most current database schema to be used.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function startup() {
|
||||
Configure::write('debug', 2);
|
||||
Configure::write('Cache.disable', 1);
|
||||
parent::startup();
|
||||
}
|
||||
|
|
|
@ -302,7 +302,7 @@ class ControllerTask extends BakeTask {
|
|||
/**
|
||||
* Assembles and writes a Controller file
|
||||
*
|
||||
* @param string $controllerName Controller name
|
||||
* @param string $controllerName Controller name already pluralized and correctly cased.
|
||||
* @param string $actions Actions to add, or set the whole controller to use $scaffold (set $actions to 'scaffold')
|
||||
* @param array $helpers Helpers to use in controller
|
||||
* @param array $components Components to use in controller
|
||||
|
@ -321,7 +321,7 @@ class ControllerTask extends BakeTask {
|
|||
$contents = $this->Template->generate('classes', 'controller');
|
||||
|
||||
$path = $this->getPath();
|
||||
$filename = $path . $this->_controllerName($controllerName) . 'Controller.php';
|
||||
$filename = $path . $controllerName . 'Controller.php';
|
||||
if ($this->createFile($filename, $contents)) {
|
||||
return $contents;
|
||||
}
|
||||
|
|
|
@ -353,16 +353,16 @@ class DbConfigTask extends Shell {
|
|||
*/
|
||||
public function getConfig() {
|
||||
App::uses('ConnectionManager', 'Model');
|
||||
$configs = ConnectionManager::enumConnectionObjects();
|
||||
|
||||
$useDbConfig = 'default';
|
||||
$configs = get_class_vars($this->databaseClassName);
|
||||
if (!is_array($configs)) {
|
||||
$useDbConfig = key($configs);
|
||||
if (!is_array($configs) || empty($configs)) {
|
||||
return $this->execute();
|
||||
}
|
||||
|
||||
$connections = array_keys($configs);
|
||||
|
||||
if (count($connections) > 1) {
|
||||
$useDbConfig = $this->in(__d('cake_console', 'Use Database Config') .':', $connections, 'default');
|
||||
$useDbConfig = $this->in(__d('cake_console', 'Use Database Config') .':', $connections, $useDbConfig);
|
||||
}
|
||||
return $useDbConfig;
|
||||
}
|
||||
|
|
|
@ -405,6 +405,8 @@ class ModelTask extends BakeTask {
|
|||
$guess = $methods['date'];
|
||||
} elseif ($metaData['type'] == 'time') {
|
||||
$guess = $methods['time'];
|
||||
} elseif ($metaData['type'] == 'inet') {
|
||||
$guess = $methods['ip'];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -134,7 +134,6 @@ class PluginTask extends Shell {
|
|||
$out = "<?php\n\n";
|
||||
$out .= "class {$plugin}AppController extends AppController {\n\n";
|
||||
$out .= "}\n\n";
|
||||
$out .= "?>";
|
||||
$this->createFile($this->path . $plugin. DS . 'Controller' . DS . $controllerFileName, $out);
|
||||
|
||||
$modelFileName = $plugin . 'AppModel.php';
|
||||
|
@ -142,7 +141,6 @@ class PluginTask extends Shell {
|
|||
$out = "<?php\n\n";
|
||||
$out .= "class {$plugin}AppModel extends AppModel {\n\n";
|
||||
$out .= "}\n\n";
|
||||
$out .= "?>";
|
||||
$this->createFile($this->path . $plugin . DS . 'Model' . DS . $modelFileName, $out);
|
||||
|
||||
$this->hr();
|
||||
|
|
|
@ -116,18 +116,22 @@ class TestTask extends BakeTask {
|
|||
* @return string|boolean
|
||||
*/
|
||||
public function bake($type, $className) {
|
||||
if ($this->typeCanDetectFixtures($type) && $this->isLoadableClass($type, $className)) {
|
||||
$plugin = null;
|
||||
if ($this->plugin) {
|
||||
$plugin = $this->plugin . '.';
|
||||
}
|
||||
|
||||
$realType = $this->mapType($type, $plugin);
|
||||
$fullClassName = $this->getRealClassName($type, $className);
|
||||
|
||||
if ($this->typeCanDetectFixtures($type) && $this->isLoadableClass($realType, $fullClassName)) {
|
||||
$this->out(__d('cake_console', 'Bake is detecting possible fixtures...'));
|
||||
$testSubject = $this->buildTestSubject($type, $className);
|
||||
$this->generateFixtureList($testSubject);
|
||||
} elseif ($this->interactive) {
|
||||
$this->getUserFixtures();
|
||||
}
|
||||
$fullClassName = $className;
|
||||
|
||||
if (!$this->interactive) {
|
||||
$fullClassName = $this->getRealClassName($type, $className);
|
||||
}
|
||||
App::uses($fullClassName, $realType);
|
||||
|
||||
$methods = array();
|
||||
if (class_exists($fullClassName)) {
|
||||
|
@ -136,15 +140,14 @@ class TestTask extends BakeTask {
|
|||
$mock = $this->hasMockClass($type, $fullClassName);
|
||||
$construction = $this->generateConstructor($type, $fullClassName);
|
||||
|
||||
$plugin = null;
|
||||
if ($this->plugin) {
|
||||
$plugin = $this->plugin . '.';
|
||||
}
|
||||
$this->out("\n" . __d('cake_console', 'Baking test case for %s %s ...', $className, $type), 1, Shell::QUIET);
|
||||
|
||||
$this->Template->set('fixtures', $this->_fixtures);
|
||||
$this->Template->set('plugin', $plugin);
|
||||
$this->Template->set(compact('className', 'methods', 'type', 'fullClassName', 'mock', 'construction'));
|
||||
$this->Template->set(compact(
|
||||
'className', 'methods', 'type', 'fullClassName', 'mock',
|
||||
'construction', 'realType'
|
||||
));
|
||||
$out = $this->Template->generate('classes', 'test');
|
||||
|
||||
$filename = $this->testCaseFileName($type, $className);
|
||||
|
@ -187,15 +190,10 @@ class TestTask extends BakeTask {
|
|||
* @return string Class name the user chose.
|
||||
*/
|
||||
public function getClassName($objectType) {
|
||||
$type = strtolower($objectType);
|
||||
$type = ucfirst(strtolower($objectType));
|
||||
$typeLength = strlen($type);
|
||||
$type = $this->classTypes[$type];
|
||||
if ($this->plugin) {
|
||||
if ($type === 'helper') {
|
||||
$type = 'View/Helper';
|
||||
} elseif ($type === 'component') {
|
||||
$type = 'Controller/Component';
|
||||
} elseif ($type === 'behavior') {
|
||||
$type = 'Model/Behavior';
|
||||
}
|
||||
$plugin = $this->plugin . '.';
|
||||
$options = App::objects($plugin . $type);
|
||||
} else {
|
||||
|
@ -209,7 +207,10 @@ class TestTask extends BakeTask {
|
|||
}
|
||||
$selection = $this->in(__d('cake_console', 'Choose an existing class, or enter the name of a class that does not exist'));
|
||||
if (isset($options[$selection - 1])) {
|
||||
return $options[$selection - 1];
|
||||
$selection = $options[$selection - 1];
|
||||
}
|
||||
if ($type !== 'Model') {
|
||||
$selection = substr($selection, 0, $typeLength * - 1);
|
||||
}
|
||||
return $selection;
|
||||
}
|
||||
|
@ -223,18 +224,19 @@ class TestTask extends BakeTask {
|
|||
*/
|
||||
public function typeCanDetectFixtures($type) {
|
||||
$type = strtolower($type);
|
||||
return ($type == 'controller' || $type == 'model');
|
||||
return in_array($type, array('controller', 'model'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a class with the given type is loaded or can be loaded.
|
||||
* Check if a class with the given package is loaded or can be loaded.
|
||||
*
|
||||
* @param string $type The Type of object you are generating tests for eg. controller
|
||||
* @param string $package The package of object you are generating tests for eg. controller
|
||||
* @param string $class the Classname of the class the test is being generated for.
|
||||
* @return boolean
|
||||
*/
|
||||
public function isLoadableClass($type, $class) {
|
||||
return App::import($type, $class);
|
||||
public function isLoadableClass($package, $class) {
|
||||
App::uses($class, $package);
|
||||
return class_exists($class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -258,7 +260,8 @@ class TestTask extends BakeTask {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the real class name from the cake short form.
|
||||
* Gets the real class name from the cake short form. If the class name is already
|
||||
* suffixed with the type, the type will not be duplicated.
|
||||
*
|
||||
* @param string $type The Type of object you are generating tests for eg. controller
|
||||
* @param string $class the Classname of the class the test is being generated for.
|
||||
|
@ -268,9 +271,31 @@ class TestTask extends BakeTask {
|
|||
if (strtolower($type) == 'model' || empty($this->classTypes[$type])) {
|
||||
return $class;
|
||||
}
|
||||
if (strlen($class) - strpos($class, $type) == strlen($type)) {
|
||||
return $class;
|
||||
}
|
||||
return $class . $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Map the types that TestTask uses to concrete types that App::uses can use.
|
||||
*
|
||||
* @param string $type The type of thing having a test generated.
|
||||
* @param string $plugin The plugin name.
|
||||
* @return string
|
||||
*/
|
||||
public function mapType($type, $plugin) {
|
||||
$type = ucfirst($type);
|
||||
if (empty($this->classTypes[$type])) {
|
||||
throw new CakeException(__d('cake_dev', 'Invalid object type.'));
|
||||
}
|
||||
$real = $this->classTypes[$type];
|
||||
if ($plugin) {
|
||||
$real = trim($plugin, '.') . '.' . $real;
|
||||
}
|
||||
return $real;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get methods declared in the class given.
|
||||
* No parent methods will be returned
|
||||
|
@ -429,9 +454,7 @@ class TestTask extends BakeTask {
|
|||
if (isset($this->classTypes[$type])) {
|
||||
$path .= $this->classTypes[$type] . DS;
|
||||
}
|
||||
if (!$this->interactive) {
|
||||
$className = $this->getRealClassName($type, $className);
|
||||
}
|
||||
$className = $this->getRealClassName($type, $className);
|
||||
return str_replace('/', DS, $path) . Inflector::camelize($className) . 'Test.php';
|
||||
}
|
||||
|
||||
|
|
|
@ -327,7 +327,7 @@ class ViewTask extends BakeTask {
|
|||
$this->hr();
|
||||
$this->out(__d('cake_console', 'Controller Name: %s', $this->controllerName));
|
||||
$this->out(__d('cake_console', 'Action Name: %s', $action));
|
||||
$this->out(__d('cake_console', 'Path: %s', $this->params['app'] . DS . $this->controllerName . DS . Inflector::underscore($action) . ".ctp"));
|
||||
$this->out(__d('cake_console', 'Path: %s', $this->params['app'] . DS . 'View' . DS . $this->controllerName . DS . Inflector::underscore($action) . ".ctp"));
|
||||
$this->hr();
|
||||
$looksGood = $this->in(__d('cake_console', 'Look okay?'), array('y','n'), 'y');
|
||||
if (strtolower($looksGood) == 'y') {
|
||||
|
@ -449,10 +449,11 @@ class ViewTask extends BakeTask {
|
|||
|
||||
foreach ($keys as $key => $type) {
|
||||
foreach ($model->{$type} as $assocKey => $assocData) {
|
||||
list($plugin, $modelClass) = pluginSplit($assocData['className']);
|
||||
$associations[$type][$assocKey]['primaryKey'] = $model->{$assocKey}->primaryKey;
|
||||
$associations[$type][$assocKey]['displayField'] = $model->{$assocKey}->displayField;
|
||||
$associations[$type][$assocKey]['foreignKey'] = $assocData['foreignKey'];
|
||||
$associations[$type][$assocKey]['controller'] = Inflector::pluralize(Inflector::underscore($assocData['className']));
|
||||
$associations[$type][$assocKey]['controller'] = Inflector::pluralize(Inflector::underscore($modelClass));
|
||||
$associations[$type][$assocKey]['fields'] = array_keys($model->{$assocKey}->schema(true));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,6 +92,29 @@ class UpgradeShell extends Shell {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update tests.
|
||||
*
|
||||
* - Update tests class names to FooTest rather than FooTestCase.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function tests() {
|
||||
$this->_paths = array(APP . 'tests' . DS);
|
||||
if (!empty($this->params['plugin'])) {
|
||||
$this->_paths = App::pluginPath($this->params['plugin']) . 'tests' . DS;
|
||||
}
|
||||
$patterns = array(
|
||||
array(
|
||||
'*TestCase extends CakeTestCase to *Test extends CakeTestCase',
|
||||
'/([a-zA-Z]*Test)Case extends CakeTestCase/',
|
||||
'\1 extends CakeTestCase'
|
||||
),
|
||||
);
|
||||
|
||||
$this->_filesRegexpUpdate($patterns);
|
||||
}
|
||||
|
||||
/**
|
||||
* Move files and folders to their new homes
|
||||
*
|
||||
|
@ -109,7 +132,6 @@ class UpgradeShell extends Shell {
|
|||
}
|
||||
|
||||
if (is_dir('plugins')) {
|
||||
|
||||
$Folder = new Folder('plugins');
|
||||
list($plugins) = $Folder->read();
|
||||
foreach($plugins as $plugin) {
|
||||
|
@ -120,8 +142,13 @@ class UpgradeShell extends Shell {
|
|||
chdir($cwd);
|
||||
}
|
||||
|
||||
$this->_moveViewFiles();
|
||||
|
||||
$moves = array(
|
||||
'libs' => 'Lib',
|
||||
'tests' => 'Test',
|
||||
'Test' . DS . 'cases' => 'Test' . DS . 'Case',
|
||||
'Test' . DS . 'fixtures' => 'Test' . DS . 'Fixture',
|
||||
'vendors' . DS . 'shells' . DS . 'templates' => 'Console' . DS . 'Templates',
|
||||
);
|
||||
foreach($moves as $old => $new) {
|
||||
|
@ -145,6 +172,7 @@ class UpgradeShell extends Shell {
|
|||
'Lib' => array('checkFolder' => false),
|
||||
'Model',
|
||||
'models',
|
||||
'Test' => array('regex' => '@class (\S*Test) extends CakeTestCase@'),
|
||||
'tests',
|
||||
'View',
|
||||
'views',
|
||||
|
@ -154,6 +182,7 @@ class UpgradeShell extends Shell {
|
|||
$defaultOptions = array(
|
||||
'recursive' => true,
|
||||
'checkFolder' => true,
|
||||
'regex' => '@class (\S*) .*{@i'
|
||||
);
|
||||
foreach($sourceDirs as $dir => $options) {
|
||||
if (is_numeric($dir)) {
|
||||
|
@ -240,7 +269,7 @@ class UpgradeShell extends Shell {
|
|||
*
|
||||
* - a(*) -> array(*)
|
||||
* - e(*) -> echo *
|
||||
* - ife(*, *, *) -> empty(*) ? * : *
|
||||
* - ife(*, *, *) -> !empty(*) ? * : *
|
||||
* - a(*) -> array(*)
|
||||
* - r(*, *, *) -> str_replace(*, *, *)
|
||||
* - up(*) -> strtoupper(*)
|
||||
|
@ -268,9 +297,9 @@ class UpgradeShell extends Shell {
|
|||
'echo \1'
|
||||
),
|
||||
array(
|
||||
'ife(*, *, *) -> empty(*) ? * : *',
|
||||
'ife(*, *, *) -> !empty(*) ? * : *',
|
||||
'/ife\((.*), (.*), (.*)\)/',
|
||||
'empty(\1) ? \2 : \3'
|
||||
'!empty(\1) ? \2 : \3'
|
||||
),
|
||||
array(
|
||||
'r(*, *, *) -> str_replace(*, *, *)',
|
||||
|
@ -478,6 +507,39 @@ class UpgradeShell extends Shell {
|
|||
$this->_filesRegexpUpdate($patterns);
|
||||
}
|
||||
|
||||
/**
|
||||
* Move application views files to where they now should be
|
||||
*
|
||||
* Find all view files in the folder and determine where cake expects the file to be
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _moveViewFiles() {
|
||||
if (!is_dir('views')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$dirs = scandir('views');
|
||||
foreach ($dirs as $old) {
|
||||
if (!is_dir('views' . DS . $old) || $old === '.' || $old === '..') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$new = 'View' . DS . Inflector::camelize($old);
|
||||
$old = 'views' . DS . $old;
|
||||
|
||||
$this->out(__d('cake_console', 'Moving %s to %s', $old, $new));
|
||||
if (!$this->params['dry-run']) {
|
||||
if ($this->params['git']) {
|
||||
exec('git mv -f ' . escapeshellarg($old) . ' ' . escapeshellarg($new));
|
||||
} else {
|
||||
$Folder = new Folder($old);
|
||||
$Folder->move($new);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Move application php files to where they now should be
|
||||
*
|
||||
|
@ -513,7 +575,7 @@ class UpgradeShell extends Shell {
|
|||
$file = $cwd . DS . $file;
|
||||
|
||||
$contents = file_get_contents($file);
|
||||
preg_match('@class (\S*) .*{@', $contents, $match);
|
||||
preg_match($options['regex'], $contents, $match);
|
||||
if (!$match) {
|
||||
continue;
|
||||
}
|
||||
|
@ -665,6 +727,10 @@ class UpgradeShell extends Shell {
|
|||
'help' => __d('cake_console', 'Run all upgrade commands.'),
|
||||
'parser' => $subcommandParser
|
||||
))
|
||||
->addSubcommand('tests', array(
|
||||
'help' => __d('cake_console', 'Update tests class names to FooTest rather than FooTestCase.'),
|
||||
'parser' => $subcommandParser
|
||||
))
|
||||
->addSubcommand('locations', array(
|
||||
'help' => __d('cake_console', 'Move files and folders to their new homes.'),
|
||||
'parser' => $subcommandParser
|
||||
|
|
|
@ -25,7 +25,7 @@ App::uses('CakeLog', 'Log');
|
|||
*
|
||||
* @package Cake.Console
|
||||
*/
|
||||
class ConsoleErrorHandler extends ErrorHandler {
|
||||
class ConsoleErrorHandler {
|
||||
|
||||
/**
|
||||
* Standard error stream.
|
||||
|
@ -52,12 +52,13 @@ class ConsoleErrorHandler extends ErrorHandler {
|
|||
* @param Exception $exception The exception to handle
|
||||
* @return void
|
||||
*/
|
||||
public static function handleException(Exception $exception) {
|
||||
public function handleException(Exception $exception) {
|
||||
$stderr = self::getStderr();
|
||||
$stderr->write(__d('cake_console', "<error>Error:</error> %s\n%s",
|
||||
$exception->getMessage(),
|
||||
$exception->getTraceAsString()
|
||||
));
|
||||
$this->_stop($exception->getCode() ? $exception->getCode() : 1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -71,12 +72,12 @@ class ConsoleErrorHandler extends ErrorHandler {
|
|||
* @param array $context The backtrace of the error.
|
||||
* @return void
|
||||
*/
|
||||
public static function handleError($code, $description, $file = null, $line = null, $context = null) {
|
||||
public function handleError($code, $description, $file = null, $line = null, $context = null) {
|
||||
if (error_reporting() === 0) {
|
||||
return;
|
||||
}
|
||||
$stderr = self::getStderr();
|
||||
list($name, $log) = self::_mapErrorCode($code);
|
||||
list($name, $log) = ErrorHandler::mapErrorCode($code);
|
||||
$message = __d('cake_console', '%s in [%s, line %s]', $description, $file, $line);
|
||||
$stderr->write(__d('cake_console', "<error>%s Error:</error> %s\n", $name, $message));
|
||||
|
||||
|
@ -85,4 +86,13 @@ class ConsoleErrorHandler extends ErrorHandler {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for exit(), used for testing.
|
||||
*
|
||||
* @param $code int The exit code.
|
||||
*/
|
||||
protected function _stop($code = 0) {
|
||||
exit($code);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -351,7 +351,8 @@ class Shell extends Object {
|
|||
$this->OptionParser = $this->getOptionParser();
|
||||
list($this->params, $this->args) = $this->OptionParser->parse($argv, $command);
|
||||
} catch (ConsoleException $e) {
|
||||
return $this->out($this->OptionParser->help($command));
|
||||
$this->out($this->OptionParser->help($command));
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->command = $command;
|
||||
|
@ -373,7 +374,8 @@ class Shell extends Object {
|
|||
if ($isMain) {
|
||||
return $this->main();
|
||||
}
|
||||
return $this->out($this->OptionParser->help($command));
|
||||
$this->out($this->OptionParser->help($command));
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -446,13 +448,11 @@ class Shell extends Object {
|
|||
}
|
||||
}
|
||||
if (is_array($options)) {
|
||||
while ($in == '' || ($in && (!in_array(strtolower($in), $options) && !in_array(strtoupper($in), $options)) && !in_array($in, $options))) {
|
||||
while ($in === '' || ($in !== '' && (!in_array(strtolower($in), $options) && !in_array(strtoupper($in), $options)) && !in_array($in, $options))) {
|
||||
$in = $this->_getInput($prompt, $options, $default);
|
||||
}
|
||||
}
|
||||
if ($in) {
|
||||
return $in;
|
||||
}
|
||||
return $in;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -482,7 +482,7 @@ class Shell extends Object {
|
|||
}
|
||||
$result = trim($result);
|
||||
|
||||
if ($default != null && empty($result)) {
|
||||
if ($default !== null && ($result === '' || $result === null)) {
|
||||
return $default;
|
||||
}
|
||||
return $result;
|
||||
|
|
|
@ -135,8 +135,9 @@ class ShellDispatcher {
|
|||
App::build();
|
||||
}
|
||||
require_once CAKE . 'Console' . DS . 'ConsoleErrorHandler.php';
|
||||
set_exception_handler(array('ConsoleErrorHandler', 'handleException'));
|
||||
set_error_handler(array('ConsoleErrorHandler', 'handleError'), Configure::read('Error.level'));
|
||||
$ErrorHandler = new ConsoleErrorHandler();
|
||||
set_exception_handler(array($ErrorHandler, 'handleException'));
|
||||
set_error_handler(array($ErrorHandler, 'handleError'), Configure::read('Error.level'));
|
||||
|
||||
if (!defined('FULL_BASE_URL')) {
|
||||
define('FULL_BASE_URL', 'http://localhost');
|
||||
|
@ -200,12 +201,11 @@ class ShellDispatcher {
|
|||
*
|
||||
* @param string $shell Optionally the name of a plugin
|
||||
* @return mixed An object
|
||||
* @throws MissingShellFileException when errors are encountered.
|
||||
* @throws MissingShellException when errors are encountered.
|
||||
*/
|
||||
protected function _getShell($shell) {
|
||||
list($plugin, $shell) = pluginSplit($shell, true);
|
||||
|
||||
|
||||
$class = Inflector::camelize($shell) . 'Shell';
|
||||
|
||||
App::uses('Shell', 'Console');
|
||||
|
@ -213,7 +213,9 @@ class ShellDispatcher {
|
|||
App::uses($class, $plugin . 'Console/Command');
|
||||
|
||||
if (!class_exists($class)) {
|
||||
throw new MissingShellFileException(array('shell' => $shell));
|
||||
throw new MissingShellException(array(
|
||||
'class' => $class
|
||||
));
|
||||
}
|
||||
$Shell = new $class();
|
||||
return $Shell;
|
||||
|
|
|
@ -54,7 +54,7 @@ class TaskCollection extends ObjectCollection {
|
|||
* @param string $task Task name to load
|
||||
* @param array $settings Settings for the task.
|
||||
* @return Task A task object, Either the existing loaded task or a new one.
|
||||
* @throws MissingTaskFileException, MissingTaskClassException when the task could not be found
|
||||
* @throws MissingTaskException when the task could not be found
|
||||
*/
|
||||
public function load($task, $settings = array()) {
|
||||
list($plugin, $name) = pluginSplit($task, true);
|
||||
|
@ -66,7 +66,9 @@ class TaskCollection extends ObjectCollection {
|
|||
App::uses($taskClass, $plugin . 'Console/Command/Task');
|
||||
if (!class_exists($taskClass)) {
|
||||
if (!class_exists($taskClass)) {
|
||||
throw new MissingTaskClassException($taskClass);
|
||||
throw new MissingTaskException(array(
|
||||
'class' => $taskClass
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
*
|
||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package cake.console.libs.template.objects
|
||||
* @package Cake.Console.Templates.default.actions
|
||||
* @since CakePHP(tm) v 1.3
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*
|
||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package Cake.Console.Templates.default.actions
|
||||
* @package Cake.Console.Templates.default.classes
|
||||
* @since CakePHP(tm) v 1.3
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*
|
||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package Cake.Console.Templates.default.actions
|
||||
* @package Cake.Console.Templates.default.classes
|
||||
* @since CakePHP(tm) v 1.3
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*
|
||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package Cake.Console.Templates.default.actions
|
||||
* @package Cake.Console.Templates.default.classes
|
||||
* @since CakePHP(tm) v 1.3
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
|
|
@ -13,14 +13,14 @@
|
|||
*
|
||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package Cake.Console.Templates.default.actions
|
||||
* @package Cake.Console.Templates.default.classes
|
||||
* @since CakePHP(tm) v 1.3
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
echo "<?php\n";
|
||||
echo "/* ". $className ." Test cases generated on: " . date('Y-m-d H:i:s') . " : ". time() . "*/\n";
|
||||
?>
|
||||
App::uses('<?php echo $fullClassName; ?>', '<?php echo $plugin . $type;?>');
|
||||
App::uses('<?php echo $fullClassName; ?>', '<?php echo $realType; ?>');
|
||||
|
||||
<?php if ($mock and strtolower($type) == 'controller'): ?>
|
||||
/**
|
||||
|
@ -81,7 +81,6 @@ class <?php echo $fullClassName; ?>TestCase extends CakeTestCase {
|
|||
*/
|
||||
public function tearDown() {
|
||||
unset($this-><?php echo $className;?>);
|
||||
ClassRegistry::flush();
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*
|
||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package cake.console.libs.templates.views
|
||||
* @package Cake.Console.Templates.default.views
|
||||
* @since CakePHP(tm) v 1.2.0.5234
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
|
|
@ -3,15 +3,28 @@ $output = "
|
|||
<iframe src=\"http://cakephp.org/bake-banner\" width=\"830\" height=\"160\" style=\"overflow:hidden; border:none;\">
|
||||
<p>For updates and important announcements, visit http://cakefest.org</p>
|
||||
</iframe>\n";
|
||||
$output = "<h2>Sweet, \"" . Inflector::humanize($app) . "\" got Baked by CakePHP!</h2>\n";
|
||||
$output .= "<h2>Sweet, \"" . Inflector::humanize($app) . "\" got Baked by CakePHP!</h2>\n";
|
||||
$output .="
|
||||
<?php
|
||||
App::uses('Debugger', 'Utility');
|
||||
if (Configure::read() > 0):
|
||||
if (Configure::read('debug') > 0):
|
||||
Debugger::checkSecurityKeys();
|
||||
endif;
|
||||
?>
|
||||
<p>
|
||||
<?php
|
||||
if (version_compare(PHP_VERSION, '5.2.6', '>=')):
|
||||
echo '<span class=\"notice success\">';
|
||||
echo __d('cake_dev', 'Your version of PHP is 5.2.6 or higher.');
|
||||
echo '</span>';
|
||||
else:
|
||||
echo '<span class=\"notice\">';
|
||||
echo __d('cake_dev', 'Your version of PHP is too low. You need PHP 5.2.6 or higher to use CakePHP.');
|
||||
echo '</span>';
|
||||
endif;
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
if (is_writable(TMP)):
|
||||
echo '<span class=\"notice success\">';
|
||||
|
@ -88,7 +101,7 @@ if (isset(\$filePresent)):
|
|||
echo '</span></p>';
|
||||
}
|
||||
?>\n";
|
||||
$output .= "<h3><?php echo __d('cake_dev', 'Editing this Page') ?></h3>\n";
|
||||
$output .= "<h3><?php echo __d('cake_dev', 'Editing this Page'); ?></h3>\n";
|
||||
$output .= "<p>\n";
|
||||
$output .= "<?php\n";
|
||||
$output .= "\techo __d('cake_dev', 'To change the content of this page, edit: %s\n";
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*
|
||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package cake.console.libs.templates.views
|
||||
* @package Cake.Console.Templates.default.views
|
||||
* @since CakePHP(tm) v 1.2.0.5234
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*
|
||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package cake.console.libs.templates.views
|
||||
* @package Cake.Console.Templates.default.views
|
||||
* @since CakePHP(tm) v 1.2.0.5234
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package app.Config
|
||||
* @package app.Config.Schema
|
||||
* @since CakePHP(tm) v 0.2.9
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package app.Config
|
||||
* @package app.Config.Schema
|
||||
* @since CakePHP(tm) v 0.2.9
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package app.Config
|
||||
* @package app.Config.Schema
|
||||
* @since CakePHP(tm) v 0.2.9
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
;<?php exit() ?>
|
||||
; SVN FILE: $Id$
|
||||
;/**
|
||||
; * ACL Configuration
|
||||
; *
|
||||
; *
|
||||
; * PHP 5
|
||||
; *
|
||||
; * CakePHP(tm) : Rapid Development Framework http://www.cakephp.org/
|
||||
; * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
; * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
; *
|
||||
; * Licensed under The MIT License
|
||||
|
@ -14,7 +13,7 @@
|
|||
; *
|
||||
; * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
; * @link http://cakephp.org CakePHP(tm) Project
|
||||
; * @package Cake.Console.Templates.skel.Config
|
||||
; * @package app.Config
|
||||
; * @since CakePHP(tm) v 0.10.0.1076
|
||||
; * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
; */
|
||||
|
|
|
@ -30,16 +30,16 @@ Cache::config('default', array('engine' => 'File'));
|
|||
* The settings below can be used to set additional paths to models, views and controllers.
|
||||
*
|
||||
* App::build(array(
|
||||
* 'plugins' => array('/full/path/to/plugins/', '/next/full/path/to/plugins/'),
|
||||
* 'models' => array('/full/path/to/models/', '/next/full/path/to/models/'),
|
||||
* 'views' => array('/full/path/to/views/', '/next/full/path/to/views/'),
|
||||
* 'controllers' => array('/full/path/to/controllers/', '/next/full/path/to/controllers/'),
|
||||
* 'datasources' => array('/full/path/to/datasources/', '/next/full/path/to/datasources/'),
|
||||
* 'behaviors' => array('/full/path/to/behaviors/', '/next/full/path/to/behaviors/'),
|
||||
* 'components' => array('/full/path/to/components/', '/next/full/path/to/components/'),
|
||||
* 'helpers' => array('/full/path/to/helpers/', '/next/full/path/to/helpers/'),
|
||||
* 'vendors' => array('/full/path/to/vendors/', '/next/full/path/to/vendors/'),
|
||||
* 'shells' => array('/full/path/to/shells/', '/next/full/path/to/shells/'),
|
||||
* 'Plugin' => array('/full/path/to/plugins/', '/next/full/path/to/plugins/'),
|
||||
* 'Model' => array('/full/path/to/models/', '/next/full/path/to/models/'),
|
||||
* 'View' => array('/full/path/to/views/', '/next/full/path/to/views/'),
|
||||
* 'Controller' => array('/full/path/to/controllers/', '/next/full/path/to/controllers/'),
|
||||
* 'Model/Datasource' => array('/full/path/to/datasources/', '/next/full/path/to/datasources/'),
|
||||
* 'Model/Behavior' => array('/full/path/to/behaviors/', '/next/full/path/to/behaviors/'),
|
||||
* 'Controller/Component' => array('/full/path/to/components/', '/next/full/path/to/components/'),
|
||||
* 'View/Helper' => array('/full/path/to/helpers/', '/next/full/path/to/helpers/'),
|
||||
* 'Vendor' => array('/full/path/to/vendors/', '/next/full/path/to/vendors/'),
|
||||
* 'Console/Command' => array('/full/path/to/shells/', '/next/full/path/to/shells/'),
|
||||
* 'locales' => array('/full/path/to/locale/', '/next/full/path/to/locale/')
|
||||
* ));
|
||||
*
|
||||
|
@ -62,4 +62,4 @@ Cache::config('default', array('engine' => 'File'));
|
|||
* CakePlugin::loadAll(); // Loads all plugins at once
|
||||
* CakePlugin::load('DebugKit'); //Loads a single plugin named DebugKit
|
||||
*
|
||||
*/
|
||||
*/
|
||||
|
|
|
@ -196,8 +196,8 @@
|
|||
* Will append a querystring parameter containing the time the file was modified. This is
|
||||
* useful for invalidating browser caches.
|
||||
*
|
||||
* Set to `true` to apply timestamps, when debug = 0, or set to 'force' to always enable
|
||||
* timestamping.
|
||||
* Set to `true` to apply timestamps when debug > 0. Set to 'force' to always enable
|
||||
* timestamping regardless of debug value.
|
||||
*/
|
||||
//Configure::write('Asset.timestamp', true);
|
||||
/**
|
||||
|
|
|
@ -54,6 +54,8 @@
|
|||
* For MySQL, Postgres specifies the character encoding to use when connecting to the
|
||||
* database. Uses database default not specified.
|
||||
*
|
||||
* unix_socket =>
|
||||
* For MySQL to connect via socket specify the `unix_socket` parameter instead of `host` and `port`
|
||||
*/
|
||||
class DATABASE_CONFIG {
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
* transport => The name of a supported transport; valid options are as follows:
|
||||
* Mail - Send using PHP mail function
|
||||
* Smtp - Send using SMTP
|
||||
* Debug - Do not send the email, just return the result
|
||||
*
|
||||
* You can add custom transports (or override existing transports) by adding the
|
||||
* appropriate file to app/Network/Email. Transports should be named 'YourTransport.php',
|
||||
|
@ -43,18 +44,23 @@ class EmailConfig {
|
|||
|
||||
public $default = array(
|
||||
'transport' => 'Mail',
|
||||
'from' => 'you@localhost'
|
||||
'from' => 'you@localhost',
|
||||
//'charset' => 'utf-8',
|
||||
//'headerCharset' => 'utf-8',
|
||||
);
|
||||
|
||||
public $smtp = array(
|
||||
'transport' => 'Smtp',
|
||||
'from' => array('My Site', 'site@localhost'),
|
||||
'from' => array('site@localhost' => 'My Site'),
|
||||
'host' => 'localhost',
|
||||
'port' => 25,
|
||||
'timeout' => 30,
|
||||
'username' => 'user',
|
||||
'password' => 'secret',
|
||||
'client' => null
|
||||
'client' => null,
|
||||
'log' => false
|
||||
//'charset' => 'utf-8',
|
||||
//'headerCharset' => 'utf-8',
|
||||
);
|
||||
|
||||
public $fast = array(
|
||||
|
@ -82,7 +88,10 @@ class EmailConfig {
|
|||
'timeout' => 30,
|
||||
'username' => 'user',
|
||||
'password' => 'secret',
|
||||
'client' => null
|
||||
'client' => null,
|
||||
'log' => true,
|
||||
//'charset' => 'utf-8',
|
||||
//'headerCharset' => 'utf-8',
|
||||
);
|
||||
|
||||
}
|
||||
|
|
|
@ -11,15 +11,23 @@
|
|||
# Redistributions of files must retain the above copyright notice.
|
||||
#
|
||||
# @copyright Copyright 2005-2011, Cake Software Foundation, Inc.
|
||||
# @link http://cakephp.org CakePHP(tm) Project
|
||||
# @link http://cakephp.org CakePHP(tm) Project
|
||||
# @package app.Console
|
||||
# @since CakePHP(tm) v 2.0
|
||||
# @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
# @since CakePHP(tm) v 2.0
|
||||
# @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
#
|
||||
################################################################################
|
||||
LIB=${0/%cake/}
|
||||
LIB=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && LIB=$LIB/$(basename -- "$0")
|
||||
|
||||
while [ -h "$LIB" ]; do
|
||||
DIR=$(dirname -- "$LIB")
|
||||
SYM=$(readlink "$LIB")
|
||||
LIB=$(cd "$DIR" && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
|
||||
done
|
||||
|
||||
LIB=$(dirname -- "$LIB")/
|
||||
APP=`pwd`
|
||||
|
||||
exec php -q ${LIB}cake.php -working "${APP}" "$@"
|
||||
exec php -q "$LIB"cake.php -working "$APP" "$@"
|
||||
|
||||
exit;
|
|
@ -1,32 +1,32 @@
|
|||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
::
|
||||
:: Bake is a shell script for running CakePHP bake script
|
||||
:: PHP 5
|
||||
::
|
||||
:: CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
:: Copyright 2005-2011, Cake Software Foundation, Inc.
|
||||
::
|
||||
:: Licensed under The MIT License
|
||||
:: Redistributions of files must retain the above copyright notice.
|
||||
::
|
||||
:: @copyright Copyright 2005-2011, Cake Software Foundation, Inc.
|
||||
:: @link http://cakephp.org CakePHP(tm) Project
|
||||
:: @package app.Console
|
||||
:: @since CakePHP(tm) v 2.0
|
||||
:: @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
::
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
|
||||
:: In order for this script to work as intended, the cake\console\ folder must be in your PATH
|
||||
|
||||
@echo.
|
||||
@echo off
|
||||
|
||||
SET app=%0
|
||||
SET lib=%~dp0
|
||||
|
||||
php -q "%lib%cake.php" -working "%CD% " %*
|
||||
|
||||
echo.
|
||||
|
||||
exit /B %ERRORLEVEL%
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
::
|
||||
:: Bake is a shell script for running CakePHP bake script
|
||||
:: PHP 5
|
||||
::
|
||||
:: CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
:: Copyright 2005-2011, Cake Software Foundation, Inc.
|
||||
::
|
||||
:: Licensed under The MIT License
|
||||
:: Redistributions of files must retain the above copyright notice.
|
||||
::
|
||||
:: @copyright Copyright 2005-2011, Cake Software Foundation, Inc.
|
||||
:: @link http://cakephp.org CakePHP(tm) Project
|
||||
:: @package app.Console
|
||||
:: @since CakePHP(tm) v 2.0
|
||||
:: @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
::
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
|
||||
:: In order for this script to work as intended, the cake\console\ folder must be in your PATH
|
||||
|
||||
@echo.
|
||||
@echo off
|
||||
|
||||
SET app=%0
|
||||
SET lib=%~dp0
|
||||
|
||||
php -q "%lib%cake.php" -working "%CD% " %*
|
||||
|
||||
echo.
|
||||
|
||||
exit /B %ERRORLEVEL%
|
||||
|
|
|
@ -28,7 +28,7 @@ App::uses('Controller', 'Controller');
|
|||
* Add your application-wide methods in the class below, your controllers
|
||||
* will inherit them.
|
||||
*
|
||||
* @package Cake.Console.Templates.skel.Controller
|
||||
* @package app.Controller
|
||||
*/
|
||||
class AppController extends Controller {
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*
|
||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package Cake.Console.Templates.skel.Controller
|
||||
* @package app.Controller
|
||||
* @since CakePHP(tm) v 0.2.9
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
@ -24,7 +24,7 @@
|
|||
*
|
||||
* Override this controller by placing a copy in controllers directory of an application
|
||||
*
|
||||
* @package Cake.Console.Templates.skel.Controller
|
||||
* @package app.Controller
|
||||
*/
|
||||
class PagesController extends AppController {
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ App::uses('Model', 'Model');
|
|||
* Add your application-wide methods in the class below, your models
|
||||
* will inherit them.
|
||||
*
|
||||
* @package Cake.Console.Templates.skel.Model
|
||||
* @package app.Model
|
||||
*/
|
||||
class AppModel extends Model {
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*
|
||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package cake.libs.view.templates.elements.email.html
|
||||
* @package app.View.Emails.html
|
||||
* @since CakePHP(tm) v 0.10.0.1076
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*
|
||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package cake.libs.view.templates.elements.email.text
|
||||
* @package app.View.Emails.text
|
||||
* @since CakePHP(tm) v 0.10.0.1076
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
*
|
||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package app.View.Helper
|
||||
* @since CakePHP(tm) v 0.2.9
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
@ -22,12 +23,12 @@ App::uses('Helper', 'View');
|
|||
|
||||
/**
|
||||
* This is a placeholder class.
|
||||
* Create the same file in app/app_helper.php
|
||||
* Create the same file in app/View/Helper/AppHelper.php
|
||||
*
|
||||
* Add your application-wide methods in the class below, your helpers
|
||||
* will inherit them.
|
||||
*
|
||||
* @package Cake.Console.Templates.skel.View.Helper
|
||||
* @package app.View.Helper
|
||||
*/
|
||||
class AppHelper extends Helper {
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*
|
||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package cake.libs.view.templates.layouts
|
||||
* @package app.View.Layouts
|
||||
* @since CakePHP(tm) v 0.10.0.1076
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<?php echo $this->Html->charset(); ?>
|
||||
<title><?php echo $page_title; ?></title>
|
||||
|
||||
<?php if (Configure::read() == 0) { ?>
|
||||
<?php if (Configure::read('debug') == 0) { ?>
|
||||
<meta http-equiv="Refresh" content="<?php echo $pause?>;url=<?php echo $url?>"/>
|
||||
<?php } ?>
|
||||
<style><!--
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
|
||||
</IfModule>
|
||||
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
|
||||
</IfModule>
|
||||
|
|
|
@ -56,7 +56,7 @@ h2 {
|
|||
font-size: 190%;
|
||||
}
|
||||
h3 {
|
||||
color: #993;
|
||||
color: #2c6877;
|
||||
font-family:'Gill Sans','lucida grande', helvetica, arial, sans-serif;
|
||||
font-size: 165%;
|
||||
}
|
||||
|
@ -67,6 +67,9 @@ h4 {
|
|||
ul, li {
|
||||
margin: 0 12px;
|
||||
}
|
||||
p {
|
||||
margin: 0 0 1em 0;
|
||||
}
|
||||
|
||||
/** Layout **/
|
||||
#container {
|
||||
|
@ -158,7 +161,7 @@ table tr td {
|
|||
border-bottom:1px solid #ddd;
|
||||
}
|
||||
table tr:nth-child(even) {
|
||||
background: #f5f5f5;
|
||||
background: #f9f9f9;
|
||||
}
|
||||
td.actions {
|
||||
text-align: center;
|
||||
|
@ -168,6 +171,8 @@ table td.actions a {
|
|||
margin: 0px 6px;
|
||||
padding:2px 5px;
|
||||
}
|
||||
|
||||
/* SQL log */
|
||||
.cake-sql-log {
|
||||
background: #fff;
|
||||
}
|
||||
|
@ -181,21 +186,48 @@ table td.actions a {
|
|||
}
|
||||
|
||||
/** Paging **/
|
||||
div.paging {
|
||||
.paging {
|
||||
background:#fff;
|
||||
color: #ccc;
|
||||
margin-top: 1em;
|
||||
clear:both;
|
||||
}
|
||||
div.paging span.disabled {
|
||||
.paging .current,
|
||||
.paging .disabled,
|
||||
.paging a {
|
||||
text-decoration: none;
|
||||
padding: 5px 8px;
|
||||
display: inline-block
|
||||
}
|
||||
.paging > span {
|
||||
display: inline-block;
|
||||
border: 1px solid #ccc;
|
||||
border-left: 0;
|
||||
}
|
||||
.paging > span:hover {
|
||||
background: #efefef;
|
||||
}
|
||||
.paging .prev {
|
||||
border-left: 1px solid #ccc;
|
||||
-moz-border-radius: 4px 0 0 4px;
|
||||
-webkit-border-radius: 4px 0 0 4px;
|
||||
border-radius: 4px 0 0 4px;
|
||||
}
|
||||
.paging .next {
|
||||
-moz-border-radius: 0 4px 4px 0;
|
||||
-webkit-border-radius: 0 4px 4px 0;
|
||||
border-radius: 0 4px 4px 0;
|
||||
}
|
||||
.paging .disabled {
|
||||
color: #ddd;
|
||||
display: inline;
|
||||
}
|
||||
div.paging span.current {
|
||||
.paging .disabled:hover {
|
||||
background: transparent;
|
||||
}
|
||||
.paging .current {
|
||||
background: #efefef;
|
||||
color: #c73e14;
|
||||
}
|
||||
div.paging span a {
|
||||
}
|
||||
|
||||
/** Scaffold View **/
|
||||
dl {
|
||||
|
@ -228,20 +260,18 @@ form {
|
|||
width: 95%;
|
||||
}
|
||||
fieldset {
|
||||
border: 1px solid #ccc;
|
||||
border: none;
|
||||
margin-bottom: 1em;
|
||||
padding: 16px 20px;
|
||||
padding: 16px 10px;
|
||||
}
|
||||
fieldset legend {
|
||||
background:#fff;
|
||||
color: #e32;
|
||||
font-size: 160%;
|
||||
font-weight: bold;
|
||||
}
|
||||
fieldset fieldset {
|
||||
margin-top: 0px;
|
||||
margin-bottom: 20px;
|
||||
padding: 16px 10px;
|
||||
margin-top: 0;
|
||||
padding: 10px 0 0;
|
||||
}
|
||||
fieldset fieldset legend {
|
||||
font-size: 120%;
|
||||
|
@ -309,10 +339,13 @@ div.checkbox label {
|
|||
input[type=radio] {
|
||||
float:left;
|
||||
width:auto;
|
||||
margin: 0 3px 7px 0;
|
||||
margin: 6px 0;
|
||||
padding: 0;
|
||||
line-height: 26px;
|
||||
}
|
||||
div.radio label {
|
||||
.radio label {
|
||||
margin: 0 0 6px 20px;
|
||||
line-height: 26px;
|
||||
}
|
||||
input[type=submit] {
|
||||
display: inline;
|
||||
|
@ -321,109 +354,207 @@ input[type=submit] {
|
|||
}
|
||||
form .submit input[type=submit] {
|
||||
background:#62af56;
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(#a8ea9c), to(#62af56));
|
||||
background-image: -moz-linear-gradient(top, #a8ea9c, #62af56);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#76BF6B), to(#3B8230));
|
||||
background-image: -webkit-linear-gradient(top, #76BF6B, #3B8230);
|
||||
background-image: -moz-linear-gradient(top, #76BF6B, #3B8230);
|
||||
border-color: #2d6324;
|
||||
color: #000;
|
||||
text-shadow: #8cee7c 0px 1px 0px;
|
||||
color: #fff;
|
||||
text-shadow: rgba(0, 0, 0, 0.5) 0px -1px 0px;
|
||||
padding: 8px 10px;
|
||||
}
|
||||
form .submit input[type=submit]:hover {
|
||||
background:#4ca83d;
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(#85e573), to(#4ca83d));
|
||||
background-image: -moz-linear-gradient(top, #85e573, #4ca83d);
|
||||
background: #5BA150;
|
||||
}
|
||||
/* Form errors */
|
||||
form .error {
|
||||
background: #FFDACC;
|
||||
-moz-order-radius: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
font-weight: normal;
|
||||
}
|
||||
form .error-message {
|
||||
-moz-border-radius: none;
|
||||
-webkit-border-radius: none;
|
||||
border-radius: none;
|
||||
border: none;
|
||||
background: none;
|
||||
margin: 0;
|
||||
padding-left: 4px;
|
||||
padding-right: 0;
|
||||
}
|
||||
form .error,
|
||||
form .error-message {
|
||||
color: #9E2424;
|
||||
-webkit-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
-ms-box-shadow: none;
|
||||
-o-box-shadow: none;
|
||||
box-shadow: none;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
/** Notices and Errors **/
|
||||
div.message {
|
||||
.message {
|
||||
clear: both;
|
||||
color: #fff;
|
||||
font-size: 140%;
|
||||
font-weight: bold;
|
||||
margin: 0 0 1em 0;
|
||||
background: #c73e14;
|
||||
padding: 5px;
|
||||
}
|
||||
div.error-message {
|
||||
|
||||
.success,
|
||||
.message,
|
||||
.cake-error,
|
||||
.cake-debug,
|
||||
.notice,
|
||||
p.error,
|
||||
.error-message {
|
||||
background: #ffcc00;
|
||||
background-repeat: repeat-x;
|
||||
background-image: -moz-linear-gradient(top, #ffcc00, #E6B800);
|
||||
background-image: -ms-linear-gradient(top, #ffcc00, #E6B800);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#ffcc00), to(#E6B800));
|
||||
background-image: -webkit-linear-gradient(top, #ffcc00, #E6B800);
|
||||
background-image: -o-linear-gradient(top, #ffcc00, #E6B800);
|
||||
background-image: linear-gradient(top, #ffcc00, #E6B800);
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||
border: 1px solid rgba(0, 0, 0, 0.2);
|
||||
margin-bottom: 18px;
|
||||
padding: 7px 14px;
|
||||
color: #404040;
|
||||
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
|
||||
-moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
|
||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
|
||||
}
|
||||
.success,
|
||||
.message,
|
||||
.cake-error,
|
||||
p.error,
|
||||
.error-message {
|
||||
clear: both;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
background: #c73e14;
|
||||
background: #c43c35;
|
||||
border: 1px solid rgba(0, 0, 0, 0.5);
|
||||
background-repeat: repeat-x;
|
||||
background-image: -moz-linear-gradient(top, #ee5f5b, #c43c35);
|
||||
background-image: -ms-linear-gradient(top, #ee5f5b, #c43c35);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#ee5f5b), to(#c43c35));
|
||||
background-image: -webkit-linear-gradient(top, #ee5f5b, #c43c35);
|
||||
background-image: -o-linear-gradient(top, #ee5f5b, #c43c35);
|
||||
background-image: linear-gradient(top, #ee5f5b, #c43c35);
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
.success {
|
||||
clear: both;
|
||||
color: #fff;
|
||||
border: 1px solid rgba(0, 0, 0, 0.5);
|
||||
background: #3B8230;
|
||||
background-repeat: repeat-x;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#76BF6B), to(#3B8230));
|
||||
background-image: -webkit-linear-gradient(top, #76BF6B, #3B8230);
|
||||
background-image: -moz-linear-gradient(top, #76BF6B, #3B8230);
|
||||
background-image: -ms-linear-gradient(top, #76BF6B, #3B8230);
|
||||
background-image: -o-linear-gradient(top, #76BF6B, #3B8230);
|
||||
background-image: linear-gradient(top, #76BF6B, #3B8230);
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
p.error {
|
||||
background-color: #e32;
|
||||
color: #fff;
|
||||
font-family: Courier, monospace;
|
||||
font-family: Monaco, Consolas, Courier, monospace;
|
||||
font-size: 120%;
|
||||
line-height: 140%;
|
||||
padding: 0.8em;
|
||||
margin: 1em 0;
|
||||
}
|
||||
p.error em {
|
||||
color: #000;
|
||||
font-weight: normal;
|
||||
line-height: 140%;
|
||||
}
|
||||
.notice {
|
||||
background: #ffcc00;
|
||||
color: #000;
|
||||
display: block;
|
||||
font-family: Courier, monospace;
|
||||
font-size: 120%;
|
||||
line-height: 140%;
|
||||
padding: 0.8em;
|
||||
margin: 1em 0;
|
||||
}
|
||||
.success {
|
||||
background: green;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/** Actions **/
|
||||
div.actions ul {
|
||||
.actions ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
div.actions li {
|
||||
.actions li {
|
||||
margin:0 0 0.5em 0;
|
||||
list-style-type: none;
|
||||
white-space: nowrap;
|
||||
padding: 0;
|
||||
}
|
||||
div.actions ul li a {
|
||||
.actions ul li a {
|
||||
font-weight: normal;
|
||||
display: block;
|
||||
clear: both;
|
||||
}
|
||||
div.actions ul li a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* Buttons and button links */
|
||||
input[type=submit],
|
||||
div.actions ul li a,
|
||||
td.actions a {
|
||||
.actions ul li a,
|
||||
.actions a {
|
||||
font-weight:normal;
|
||||
padding: 4px 8px;
|
||||
background:#e6e49f;
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(#f1f1d4), to(#e6e49f));
|
||||
background-image: -moz-linear-gradient(top, #f1f1d4, #e6e49f);
|
||||
background: #dcdcdc;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#fefefe), to(#dcdcdc));
|
||||
background-image: -webkit-linear-gradient(top, #fefefe, #dcdcdc);
|
||||
background-image: -moz-linear-gradient(top, #fefefe, #dcdcdc);
|
||||
background-image: -ms-linear-gradient(top, #fefefe, #dcdcdc);
|
||||
background-image: -o-linear-gradient(top, #fefefe, #dcdcdc);
|
||||
background-image: linear-gradient(top, #fefefe, #dcdcdc);
|
||||
color:#333;
|
||||
border:1px solid #aaac62;
|
||||
-webkit-border-radius:8px;
|
||||
-moz-border-radius:8px;
|
||||
border-radius:8px;
|
||||
text-decoration:none;
|
||||
border:1px solid #bbb;
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
text-decoration: none;
|
||||
text-shadow: #fff 0px 1px 0px;
|
||||
min-width: 0;
|
||||
-moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0px 1px 1px rgba(0, 0, 0, 0.2);
|
||||
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0px 1px 1px rgba(0, 0, 0, 0.2);
|
||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0px 1px 1px rgba(0, 0, 0, 0.2);
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
input[type=submit]:hover,
|
||||
div.actions ul li a:hover,
|
||||
td.actions a:hover {
|
||||
background: #f0f09a;
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(#f7f7e1), to(#eeeca9));
|
||||
.actions ul li a:hover,
|
||||
.actions a:hover {
|
||||
background: #ededed;
|
||||
border-color: #acacac;
|
||||
text-decoration: none;
|
||||
}
|
||||
input[type=submit]:active,
|
||||
.actions ul li a:active,
|
||||
.actions a:active {
|
||||
background: #eee;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#dfdfdf), to(#eee));
|
||||
background-image: -webkit-linear-gradient(top, #dfdfdf, #eee);
|
||||
background-image: -moz-linear-gradient(top, #dfdfdf, #eee);
|
||||
background-image: -ms-linear-gradient(top, #dfdfdf, #eee);
|
||||
background-image: -o-linear-gradient(top, #dfdfdf, #eee);
|
||||
background-image: linear-gradient(top, #dfdfdf, #eee);
|
||||
text-shadow: #eee 0px 1px 0px;
|
||||
-moz-box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.3);
|
||||
-webkit-box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.3);
|
||||
box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.3);
|
||||
border-color: #aaa;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/** Related **/
|
||||
div.related {
|
||||
.related {
|
||||
clear: both;
|
||||
display: block;
|
||||
}
|
||||
|
@ -432,38 +563,92 @@ div.related {
|
|||
pre {
|
||||
color: #000;
|
||||
background: #f0f0f0;
|
||||
padding: 1em;
|
||||
padding: 15px;
|
||||
-moz-box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
|
||||
-webkit-box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
|
||||
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
pre.cake-debug {
|
||||
background: #ffcc00;
|
||||
font-size: 120%;
|
||||
line-height: 140%;
|
||||
margin-top: 1em;
|
||||
overflow: auto;
|
||||
.cake-debug-output {
|
||||
padding: 0;
|
||||
position: relative;
|
||||
}
|
||||
div.cake-stack-trace {
|
||||
background: #fff;
|
||||
.cake-debug-output > span {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right: 5px;
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
-moz-border-radius: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
padding: 5px 6px;
|
||||
color: #000;
|
||||
display: block;
|
||||
float: left;
|
||||
-moz-box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.25), 0 1px 0 rgba(255, 255, 255, 0.5);
|
||||
-webkit-box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.25), 0 1px 0 rgba(255, 255, 255, 0.5);
|
||||
box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.25), 0 1px 0 rgba(255, 255, 255, 0.5);
|
||||
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
|
||||
}
|
||||
.cake-debug,
|
||||
.cake-error {
|
||||
font-size: 16px;
|
||||
line-height: 20px;
|
||||
clear: both;
|
||||
}
|
||||
.cake-error > a {
|
||||
text-shadow: none;
|
||||
}
|
||||
.cake-error {
|
||||
white-space: normal;
|
||||
}
|
||||
.cake-stack-trace {
|
||||
background: rgba(255, 255, 255, 0.7);
|
||||
color: #333;
|
||||
margin: 0px;
|
||||
padding: 6px;
|
||||
margin: 10px 0 5px 0;
|
||||
padding: 10px 10px 0 10px;
|
||||
font-size: 120%;
|
||||
line-height: 140%;
|
||||
overflow: auto;
|
||||
position: relative;
|
||||
-moz-border-radius: 4px;
|
||||
-wekbkit-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
div.cake-code-dump pre {
|
||||
.cake-stack-trace a {
|
||||
text-shadow: none;
|
||||
background: rgba(255, 255, 255, 0.7);
|
||||
padding: 5px;
|
||||
-moz-border-radius: 10px;
|
||||
-webkit-border-radius: 10px;
|
||||
border-radius: 10px;
|
||||
margin: 0px 4px 10px 2px;
|
||||
font-family: sans-serif;
|
||||
font-size: 14px;
|
||||
line-height: 14px;
|
||||
display: inline-block;
|
||||
text-decoration: none;
|
||||
-moz-box-shadow: inset 0px 1px 0 rgba(0, 0, 0, 0.3);
|
||||
-webkit-box-shadow: inset 0px 1px 0 rgba(0, 0, 0, 0.3);
|
||||
box-shadow: inset 0px 1px 0 rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
.cake-code-dump pre {
|
||||
position: relative;
|
||||
overflow: auto;
|
||||
}
|
||||
div.cake-stack-trace pre, div.cake-code-dump pre {
|
||||
.cake-context {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.cake-stack-trace pre {
|
||||
color: #000;
|
||||
background-color: #F0F0F0;
|
||||
margin: 0px;
|
||||
margin: 0px 0 10px 0;
|
||||
padding: 1em;
|
||||
overflow: auto;
|
||||
text-shadow: none;
|
||||
}
|
||||
div.cake-code-dump pre, div.cake-code-dump pre code {
|
||||
/* excerpt */
|
||||
.cake-code-dump pre,
|
||||
.cake-code-dump pre code {
|
||||
clear: both;
|
||||
font-size: 12px;
|
||||
line-height: 15px;
|
||||
|
@ -471,25 +656,25 @@ div.cake-code-dump pre, div.cake-code-dump pre code {
|
|||
padding: 4px;
|
||||
overflow: auto;
|
||||
}
|
||||
div.cake-code-dump span.code-highlight {
|
||||
background-color: #ff0;
|
||||
padding: 4px;
|
||||
.cake-code-dump .code-highlight {
|
||||
display: block;
|
||||
background-color: rgba(255, 255, 0, 0.5);
|
||||
}
|
||||
div.code-coverage-results div.code-line {
|
||||
.code-coverage-results div.code-line {
|
||||
padding-left:5px;
|
||||
display:block;
|
||||
margin-left:10px;
|
||||
}
|
||||
div.code-coverage-results div.uncovered span.content {
|
||||
.code-coverage-results div.uncovered span.content {
|
||||
background:#ecc;
|
||||
}
|
||||
div.code-coverage-results div.covered span.content {
|
||||
.code-coverage-results div.covered span.content {
|
||||
background:#cec;
|
||||
}
|
||||
div.code-coverage-results div.ignored span.content {
|
||||
.code-coverage-results div.ignored span.content {
|
||||
color:#aaa;
|
||||
}
|
||||
div.code-coverage-results span.line-num {
|
||||
.code-coverage-results span.line-num {
|
||||
color:#666;
|
||||
display:block;
|
||||
float:left;
|
||||
|
@ -497,41 +682,41 @@ div.code-coverage-results span.line-num {
|
|||
text-align:right;
|
||||
margin-right:5px;
|
||||
}
|
||||
div.code-coverage-results span.line-num strong {
|
||||
.code-coverage-results span.line-num strong {
|
||||
color:#666;
|
||||
}
|
||||
div.code-coverage-results div.start {
|
||||
.code-coverage-results div.start {
|
||||
border:1px solid #aaa;
|
||||
border-width:1px 1px 0px 1px;
|
||||
margin-top:30px;
|
||||
padding-top:5px;
|
||||
}
|
||||
div.code-coverage-results div.end {
|
||||
.code-coverage-results div.end {
|
||||
border:1px solid #aaa;
|
||||
border-width:0px 1px 1px 1px;
|
||||
margin-bottom:30px;
|
||||
padding-bottom:5px;
|
||||
}
|
||||
div.code-coverage-results div.realstart {
|
||||
.code-coverage-results div.realstart {
|
||||
margin-top:0px;
|
||||
}
|
||||
div.code-coverage-results p.note {
|
||||
.code-coverage-results p.note {
|
||||
color:#bbb;
|
||||
padding:5px;
|
||||
margin:5px 0 10px;
|
||||
font-size:10px;
|
||||
}
|
||||
div.code-coverage-results span.result-bad {
|
||||
.code-coverage-results span.result-bad {
|
||||
color: #a00;
|
||||
}
|
||||
div.code-coverage-results span.result-ok {
|
||||
.code-coverage-results span.result-ok {
|
||||
color: #fa0;
|
||||
}
|
||||
div.code-coverage-results span.result-good {
|
||||
.code-coverage-results span.result-good {
|
||||
color: #0a0;
|
||||
}
|
||||
|
||||
/** Elements **/
|
||||
#url-rewriting-warning {
|
||||
display: none;
|
||||
display:none;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
* This should point at the directory containg `Cake`.
|
||||
*
|
||||
* For ease of development CakePHP uses PHP's include_path. If you
|
||||
* need to squeeze a bit more performance you can set this path.
|
||||
* cannot modify your include_path set this value.
|
||||
*
|
||||
* Leaving this constant undefined will result in it being defined in Cake/bootstrap.php
|
||||
*/
|
||||
|
@ -71,6 +71,9 @@
|
|||
}
|
||||
|
||||
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
|
||||
if (function_exists('ini_set')) {
|
||||
ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
|
||||
}
|
||||
if (!include('Cake' . DS . 'bootstrap.php')) {
|
||||
$failed = true;
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ if (!empty($failed)) {
|
|||
}
|
||||
|
||||
if (Configure::read('debug') < 1) {
|
||||
die(__d('cake', 'Debug setting does not allow access to this url.'));
|
||||
die(__d('cake_dev', 'Debug setting does not allow access to this url.'));
|
||||
}
|
||||
|
||||
require_once CAKE . 'TestSuite' . DS . 'CakeTestSuiteDispatcher.php';
|
||||
|
|
|
@ -17,9 +17,17 @@
|
|||
# @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
#
|
||||
################################################################################
|
||||
LIB=${0/%cake/}
|
||||
LIB=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && LIB=$LIB/$(basename -- "$0")
|
||||
|
||||
while [ -h "$LIB" ]; do
|
||||
DIR=$(dirname -- "$LIB")
|
||||
SYM=$(readlink "$LIB")
|
||||
LIB=$(cd "$DIR" && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
|
||||
done
|
||||
|
||||
LIB=$(dirname -- "$LIB")/
|
||||
APP=`pwd`
|
||||
|
||||
exec php -q ${LIB}cake.php -working "${APP}" "$@"
|
||||
exec php -q "$LIB"cake.php -working "$APP" "$@"
|
||||
|
||||
exit;
|
||||
exit;
|
||||
|
|
|
@ -24,7 +24,7 @@ App::uses('Controller', 'Controller');
|
|||
|
||||
/**
|
||||
* This is a placeholder class.
|
||||
* Create the same file in app/app_controller.php
|
||||
* Create the same file in app/Controller/AppController.php
|
||||
*
|
||||
* Add your application-wide methods in the class below, your controllers
|
||||
* will inherit them.
|
||||
|
|
|
@ -104,7 +104,7 @@ class Component extends Object {
|
|||
*
|
||||
* @param Controller $controller Controller with components to initialize
|
||||
* @return void
|
||||
* @link http://book.cakephp.org/view/998/MVC-Class-Access-Within-Components
|
||||
* @link http://book.cakephp.org/2.0/en/controllers/components.html#Component::initialize
|
||||
*/
|
||||
public function initialize($controller) { }
|
||||
|
||||
|
@ -113,7 +113,7 @@ class Component extends Object {
|
|||
*
|
||||
* @param Controller $controller Controller with components to startup
|
||||
* @return void
|
||||
* @link http://book.cakephp.org/view/998/MVC-Class-Access-Within-Components
|
||||
* @link http://book.cakephp.org/2.0/en/controllers/components.html#Component::startup
|
||||
*/
|
||||
public function startup($controller) { }
|
||||
|
||||
|
@ -123,6 +123,7 @@ class Component extends Object {
|
|||
*
|
||||
* @param Controller $controller Controller with components to beforeRender
|
||||
* @return void
|
||||
* @link http://book.cakephp.org/2.0/en/controllers/components.html#Component::beforeRender
|
||||
*/
|
||||
public function beforeRender($controller) { }
|
||||
|
||||
|
@ -131,6 +132,7 @@ class Component extends Object {
|
|||
*
|
||||
* @param Controller $controller Controller with components to shutdown
|
||||
* @return void
|
||||
* @link @link http://book.cakephp.org/2.0/en/controllers/components.html#Component::shutdown
|
||||
*/
|
||||
public function shutdown($controller) { }
|
||||
|
||||
|
@ -151,6 +153,7 @@ class Component extends Object {
|
|||
* @param integer $status The status code of the redirect
|
||||
* @param boolean $exit Will the script exit.
|
||||
* @return array|null Either an array or null.
|
||||
* @link @link http://book.cakephp.org/2.0/en/controllers/components.html#Component::beforeRedirect
|
||||
*/
|
||||
public function beforeRedirect($controller, $url, $status = null, $exit = true) {}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ App::uses('Component', 'Controller');
|
|||
* implementations should extend `AclBase` and implement the methods it defines.
|
||||
*
|
||||
* @package Cake.Controller.Component
|
||||
* @link http://book.cakephp.org/view/1242/Access-Control-Lists
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/access-control-lists.html
|
||||
*/
|
||||
class AclComponent extends Component {
|
||||
|
||||
|
@ -288,7 +288,7 @@ class DbAcl extends Object implements AclInterface {
|
|||
* @param string $aco ACO The controlled object identifier.
|
||||
* @param string $action Action (defaults to *)
|
||||
* @return boolean Success (true if ARO has access to action in ACO, false otherwise)
|
||||
* @link http://book.cakephp.org/view/1249/Checking-Permissions-The-ACL-Component
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/access-control-lists.html#checking-permissions-the-acl-component
|
||||
*/
|
||||
public function check($aro, $aco, $action = "*") {
|
||||
if ($aro == null || $aco == null) {
|
||||
|
@ -376,7 +376,7 @@ class DbAcl extends Object implements AclInterface {
|
|||
* @param string $actions Action (defaults to *)
|
||||
* @param integer $value Value to indicate access type (1 to give access, -1 to deny, 0 to inherit)
|
||||
* @return boolean Success
|
||||
* @link http://book.cakephp.org/view/1248/Assigning-Permissions
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/access-control-lists.html#assigning-permissions
|
||||
*/
|
||||
public function allow($aro, $aco, $actions = "*", $value = 1) {
|
||||
$perms = $this->getAclLink($aro, $aco);
|
||||
|
@ -427,7 +427,7 @@ class DbAcl extends Object implements AclInterface {
|
|||
* @param string $aco ACO The controlled object identifier.
|
||||
* @param string $action Action (defaults to *)
|
||||
* @return boolean Success
|
||||
* @link http://book.cakephp.org/view/1248/Assigning-Permissions
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/access-control-lists.html#assigning-permissions
|
||||
*/
|
||||
public function deny($aro, $aco, $action = "*") {
|
||||
return $this->allow($aro, $aco, $action, -1);
|
||||
|
|
|
@ -73,7 +73,7 @@ abstract class BaseAuthenticate {
|
|||
|
||||
$conditions = array(
|
||||
$model . '.' . $fields['username'] => $username,
|
||||
$model . '.' . $fields['password'] => AuthComponent::password($password),
|
||||
$model . '.' . $fields['password'] => $this->_password($password),
|
||||
);
|
||||
if (!empty($this->settings['scope'])) {
|
||||
$conditions = array_merge($conditions, $this->settings['scope']);
|
||||
|
@ -89,6 +89,17 @@ abstract class BaseAuthenticate {
|
|||
return $result[$model];
|
||||
}
|
||||
|
||||
/**
|
||||
* Hash the plain text password so that it matches the hashed/encrytped password
|
||||
* in the datasource.
|
||||
*
|
||||
* @param string $password The plain text password.
|
||||
* @return string The hashed form of the password.
|
||||
*/
|
||||
protected function _password($password) {
|
||||
return Security::hash($password, null, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Authenticate a user based on the request information.
|
||||
*
|
||||
|
|
|
@ -116,10 +116,28 @@ abstract class BaseAuthorize {
|
|||
}
|
||||
|
||||
/**
|
||||
* Maps crud actions to actual controller names. Used to modify or get the current mapped actions.
|
||||
* Maps crud actions to actual action names. Used to modify or get the current mapped actions.
|
||||
*
|
||||
* Create additional mappings for a standard CRUD operation:
|
||||
*
|
||||
* {{{
|
||||
* $this->Auth->mapActions(array('create' => array('add', 'register'));
|
||||
* }}}
|
||||
*
|
||||
* Create mappings for custom CRUD operations:
|
||||
*
|
||||
* {{{
|
||||
* $this->Auth->mapActions(array('my_action' => 'admin'));
|
||||
* }}}
|
||||
*
|
||||
* You can use the custom CRUD operations to create additional generic permissions
|
||||
* that behave like CRUD operations. Doing this will require additional columns on the
|
||||
* permissions lookup. When using with DbAcl, you'll have to add additional _admin type columns
|
||||
* to the `aros_acos` table.
|
||||
*
|
||||
* @param mixed $map Either an array of mappings, or undefined to get current values.
|
||||
* @return mixed Either the current mappings or null when setting.
|
||||
* @see AuthComponent::mapActions()
|
||||
*/
|
||||
public function mapActions($map = array()) {
|
||||
if (empty($map)) {
|
||||
|
|
|
@ -90,6 +90,7 @@ class CrudAuthorize extends BaseAuthorize {
|
|||
);
|
||||
return false;
|
||||
}
|
||||
$user = array($this->settings['userModel'] => $user);
|
||||
$Acl = $this->_Collection->load('Acl');
|
||||
return $Acl->check(
|
||||
$user,
|
||||
|
@ -97,4 +98,4 @@ class CrudAuthorize extends BaseAuthorize {
|
|||
$this->settings['actionMap'][$request->params['action']]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,4 +65,4 @@ class FormAuthenticate extends BaseAuthenticate {
|
|||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ App::uses('BaseAuthenticate', 'Controller/Component/Auth');
|
|||
* Binds access control with user authentication and session management.
|
||||
*
|
||||
* @package Cake.Controller.Component
|
||||
* @link http://book.cakephp.org/view/1250/Authentication
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html
|
||||
*/
|
||||
class AuthComponent extends Component {
|
||||
|
||||
|
@ -77,7 +77,7 @@ class AuthComponent extends Component {
|
|||
* You can also use AuthComponent::ALL instead of the string 'all'.
|
||||
*
|
||||
* @var array
|
||||
* @link http://book.cakephp.org/view/1278/authenticate
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html
|
||||
*/
|
||||
public $authenticate = array('Form');
|
||||
|
||||
|
@ -133,7 +133,6 @@ class AuthComponent extends Component {
|
|||
* with an invalid or expired session
|
||||
*
|
||||
* @var string
|
||||
* @link http://book.cakephp.org/view/1277/ajaxLogin
|
||||
*/
|
||||
public $ajaxLogin = null;
|
||||
|
||||
|
@ -158,7 +157,6 @@ class AuthComponent extends Component {
|
|||
* unspecified, it will be "Auth.User".
|
||||
*
|
||||
* @var string
|
||||
* @link http://book.cakephp.org/view/1276/sessionKey
|
||||
*/
|
||||
public static $sessionKey = 'Auth.User';
|
||||
|
||||
|
@ -167,7 +165,6 @@ class AuthComponent extends Component {
|
|||
* logins. Defaults to `/users/login`
|
||||
*
|
||||
* @var mixed
|
||||
* @link http://book.cakephp.org/view/1269/loginAction
|
||||
*/
|
||||
public $loginAction = array(
|
||||
'controller' => 'users',
|
||||
|
@ -182,7 +179,7 @@ class AuthComponent extends Component {
|
|||
* set, the user will be redirected to the page specified in $loginRedirect.
|
||||
*
|
||||
* @var mixed
|
||||
* @link http://book.cakephp.org/view/1270/loginRedirect
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#AuthComponent::$loginRedirect
|
||||
*/
|
||||
public $loginRedirect = null;
|
||||
|
||||
|
@ -194,7 +191,6 @@ class AuthComponent extends Component {
|
|||
* @var mixed
|
||||
* @see AuthComponent::$loginAction
|
||||
* @see AuthComponent::logout()
|
||||
* @link http://book.cakephp.org/view/1271/logoutRedirect
|
||||
*/
|
||||
public $logoutRedirect = null;
|
||||
|
||||
|
@ -203,7 +199,7 @@ class AuthComponent extends Component {
|
|||
* acccess.
|
||||
*
|
||||
* @var string
|
||||
* @link http://book.cakephp.org/view/1273/authError
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#AuthComponent::$authError
|
||||
*/
|
||||
public $authError = null;
|
||||
|
||||
|
@ -212,7 +208,6 @@ class AuthComponent extends Component {
|
|||
*
|
||||
* @var array
|
||||
* @see AuthComponent::allow()
|
||||
* @link http://book.cakephp.org/view/1251/Setting-Auth-Component-Variables
|
||||
*/
|
||||
public $allowedActions = array();
|
||||
|
||||
|
@ -342,7 +337,7 @@ class AuthComponent extends Component {
|
|||
protected function _setDefaults() {
|
||||
$defaults = array(
|
||||
'logoutRedirect' => $this->loginAction,
|
||||
'authError' => __d('cake', 'You are not authorized to access that location.')
|
||||
'authError' => __d('cake_dev', 'You are not authorized to access that location.')
|
||||
);
|
||||
foreach ($defaults as $key => $value) {
|
||||
if (empty($this->{$key})) {
|
||||
|
@ -429,7 +424,7 @@ class AuthComponent extends Component {
|
|||
*
|
||||
* @param mixed $action,... Controller action name or array of actions
|
||||
* @return void
|
||||
* @link http://book.cakephp.org/view/1257/allow
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#making-actions-public
|
||||
*/
|
||||
public function allow($action = null) {
|
||||
$args = func_get_args();
|
||||
|
@ -454,7 +449,7 @@ class AuthComponent extends Component {
|
|||
* @param mixed $action,... Controller action name or array of actions
|
||||
* @return void
|
||||
* @see AuthComponent::allow()
|
||||
* @link http://book.cakephp.org/view/1258/deny
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#making-actions-require-authorization
|
||||
*/
|
||||
public function deny($action = null) {
|
||||
$args = func_get_args();
|
||||
|
@ -477,7 +472,8 @@ class AuthComponent extends Component {
|
|||
*
|
||||
* @param array $map Actions to map
|
||||
* @return void
|
||||
* @link http://book.cakephp.org/view/1260/mapActions
|
||||
* @see BaseAuthorize::mapActions()
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#mapping-actions-when-using-crudauthorize
|
||||
*/
|
||||
public function mapActions($map = array()) {
|
||||
if (empty($this->_authorizeObjects)) {
|
||||
|
@ -491,11 +487,12 @@ class AuthComponent extends Component {
|
|||
/**
|
||||
* Log a user in. If a $user is provided that data will be stored as the logged in user. If `$user` is empty or not
|
||||
* specified, the request will be used to identify a user. If the identification was successful,
|
||||
* the user record is written to the session key specified in AuthComponent::$sessionKey.
|
||||
* the user record is written to the session key specified in AuthComponent::$sessionKey. Logging in
|
||||
* will also change the session id in order to help mitigate session replays.
|
||||
*
|
||||
* @param mixed $user Either an array of user data, or null to identify a user using the current request.
|
||||
* @return boolean True on login success, false on failure
|
||||
* @link http://book.cakephp.org/view/1261/login
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#identifying-users-and-logging-them-in
|
||||
*/
|
||||
public function login($user = null) {
|
||||
$this->_setDefaults();
|
||||
|
@ -504,6 +501,7 @@ class AuthComponent extends Component {
|
|||
$user = $this->identify($this->request, $this->response);
|
||||
}
|
||||
if ($user) {
|
||||
$this->Session->renew();
|
||||
$this->Session->write(self::$sessionKey, $user);
|
||||
}
|
||||
return $this->loggedIn();
|
||||
|
@ -513,11 +511,12 @@ class AuthComponent extends Component {
|
|||
* Logs a user out, and returns the login action to redirect to.
|
||||
* Triggers the logout() method of all the authenticate objects, so they can perform
|
||||
* custom logout logic. AuthComponent will remove the session data, so
|
||||
* there is no need to do that in an authentication object.
|
||||
* there is no need to do that in an authentication object. Logging out
|
||||
* will also renew the session id. This helps mitigate issues with session replays.
|
||||
*
|
||||
* @return string AuthComponent::$logoutRedirect
|
||||
* @see AuthComponent::$logoutRedirect
|
||||
* @link http://book.cakephp.org/view/1262/logout
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#logging-users-out
|
||||
*/
|
||||
public function logout() {
|
||||
$this->_setDefaults();
|
||||
|
@ -530,6 +529,7 @@ class AuthComponent extends Component {
|
|||
}
|
||||
$this->Session->delete(self::$sessionKey);
|
||||
$this->Session->delete('Auth.redirect');
|
||||
$this->Session->renew();
|
||||
return Router::normalize($this->logoutRedirect);
|
||||
}
|
||||
|
||||
|
@ -538,7 +538,7 @@ class AuthComponent extends Component {
|
|||
*
|
||||
* @param string $key field to retrive. Leave null to get entire User record
|
||||
* @return mixed User record. or null if no user is logged in.
|
||||
* @link http://book.cakephp.org/view/1264/user
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#accessing-the-logged-in-user
|
||||
*/
|
||||
public static function user($key = null) {
|
||||
if (!CakeSession::check(self::$sessionKey)) {
|
||||
|
@ -661,9 +661,12 @@ class AuthComponent extends Component {
|
|||
/**
|
||||
* Hash a password with the application's salt value (as defined with Configure::write('Security.salt');
|
||||
*
|
||||
* This method is intended as a convenience wrapper for Security::hash(). If you want to use
|
||||
* a hashing/encryption system not supported by that method, do not use this method.
|
||||
*
|
||||
* @param string $password Password to hash
|
||||
* @return string Hashed password
|
||||
* @link http://book.cakephp.org/view/1263/password
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#hashing-passwords
|
||||
*/
|
||||
public static function password($password) {
|
||||
return Security::hash($password, null, true);
|
||||
|
|
|
@ -26,7 +26,7 @@ App::uses('Security', 'Utility');
|
|||
* Cookie handling for the controller.
|
||||
*
|
||||
* @package Cake.Controller.Component
|
||||
* @link http://book.cakephp.org/view/1280/Cookies
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/cookie.html
|
||||
*
|
||||
*/
|
||||
class CookieComponent extends Component {
|
||||
|
|
|
@ -28,7 +28,8 @@ App::uses('CakeEmail', 'Network/Email');
|
|||
* based on the standard outlined in http://www.rfc-editor.org/rfc/rfc2822.txt
|
||||
*
|
||||
* @package Cake.Controller.Component
|
||||
* @link http://book.cakephp.org/view/1283/Email
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/email.html
|
||||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/email.html
|
||||
* @deprecated Use Network/CakeEmail
|
||||
*/
|
||||
class EmailComponent extends Component {
|
||||
|
@ -215,7 +216,6 @@ class EmailComponent extends Component {
|
|||
* - client
|
||||
*
|
||||
* @var array
|
||||
* @link http://book.cakephp.org/view/1290/Sending-A-Message-Using-SMTP
|
||||
*/
|
||||
public $smtpOptions = array();
|
||||
|
||||
|
@ -363,7 +363,6 @@ class EmailComponent extends Component {
|
|||
* Reset all EmailComponent internal variables to be able to send out a new email.
|
||||
*
|
||||
* @return void
|
||||
* @link http://book.cakephp.org/view/1285/Sending-Multiple-Emails-in-a-loop
|
||||
*/
|
||||
public function reset() {
|
||||
$this->template = null;
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
* This would allow you to have different pagination settings for `Comment` and `Post` models.
|
||||
*
|
||||
* @package Cake.Controller.Component
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/pagination.html
|
||||
*/
|
||||
class PaginatorComponent extends Component {
|
||||
|
||||
|
@ -340,22 +341,23 @@ class PaginatorComponent extends Component {
|
|||
}
|
||||
|
||||
if (!empty($options['order']) && is_array($options['order'])) {
|
||||
$alias = $object->alias ;
|
||||
$key = $field = key($options['order']);
|
||||
$order = array();
|
||||
foreach ($options['order'] as $key => $value) {
|
||||
$field = $key;
|
||||
$alias = $object->alias;
|
||||
if (strpos($key, '.') !== false) {
|
||||
list($alias, $field) = explode('.', $key);
|
||||
}
|
||||
|
||||
if (strpos($key, '.') !== false) {
|
||||
list($alias, $field) = explode('.', $key);
|
||||
}
|
||||
$value = $options['order'][$key];
|
||||
unset($options['order'][$key]);
|
||||
|
||||
if ($object->hasField($field)) {
|
||||
$options['order'][$alias . '.' . $field] = $value;
|
||||
} elseif ($object->hasField($field, true)) {
|
||||
$options['order'][$field] = $value;
|
||||
} elseif (isset($object->{$alias}) && $object->{$alias}->hasField($field)) {
|
||||
$options['order'][$alias . '.' . $field] = $value;
|
||||
if ($object->hasField($field)) {
|
||||
$order[$alias . '.' . $field] = $value;
|
||||
} elseif ($object->hasField($key, true)) {
|
||||
$order[$field] = $value;
|
||||
} elseif (isset($object->{$alias}) && $object->{$alias}->hasField($field)) {
|
||||
$order[$alias . '.' . $field] = $value;
|
||||
}
|
||||
}
|
||||
$options['order'] = $order;
|
||||
}
|
||||
|
||||
return $options;
|
||||
|
@ -375,4 +377,4 @@ class PaginatorComponent extends Component {
|
|||
$options['limit'] = min((int)$options['limit'], $options['maxLimit']);
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ App::uses('Xml', 'Utility');
|
|||
* Request object for handling HTTP requests
|
||||
*
|
||||
* @package Cake.Controller.Component
|
||||
* @link http://book.cakephp.org/view/1291/Request-Handling
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/request-handling.html
|
||||
*
|
||||
*/
|
||||
class RequestHandlerComponent extends Component {
|
||||
|
@ -96,10 +96,10 @@ class RequestHandlerComponent extends Component {
|
|||
}
|
||||
|
||||
/**
|
||||
* Initializes the component, gets a reference to Controller::$parameters, and
|
||||
* checks to see if a file extension has been parsed by the Router. Or if the
|
||||
* HTTP_ACCEPT_TYPE is set to a single value that is a supported extension and mapped type.
|
||||
* If yes, RequestHandler::$ext is set to that value
|
||||
* Checks to see if a file extension has been parsed by the Router, or if the
|
||||
* HTTP_ACCEPT_TYPE has matches only one content type with the supported extensions.
|
||||
* If there is only one matching type between the supported content types & extensions,
|
||||
* and the requested mime-types, RequestHandler::$ext is set to that value.
|
||||
*
|
||||
* @param Controller $controller A reference to the controller
|
||||
* @param array $settings Array of settings to _set().
|
||||
|
@ -113,19 +113,37 @@ class RequestHandlerComponent extends Component {
|
|||
$this->ext = $this->request->params['ext'];
|
||||
}
|
||||
if (empty($this->ext) || $this->ext == 'html') {
|
||||
$accepts = $this->request->accepts();
|
||||
$extensions = Router::extensions();
|
||||
if (count($accepts) == 1) {
|
||||
$mapped = $this->mapType($accepts[0]);
|
||||
if (in_array($mapped, $extensions)) {
|
||||
$this->ext = $mapped;
|
||||
}
|
||||
}
|
||||
$this->_setExtension();
|
||||
}
|
||||
$this->params = $controller->params;
|
||||
$this->_set($settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the extension based on the accept headers.
|
||||
* Compares the accepted types and configured extensions.
|
||||
* If there is one common type, that is assigned as the ext/content type
|
||||
* for the response.
|
||||
*
|
||||
* If html is one of the preferred types, no content type will be set, this
|
||||
* is to avoid issues with browsers that prefer html and several other content types.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _setExtension() {
|
||||
$accept = $this->request->parseAccept();
|
||||
if (empty($accept)) {
|
||||
return;
|
||||
}
|
||||
$extensions = Router::extensions();
|
||||
$preferred = array_shift($accept);
|
||||
$preferredTypes = $this->mapType($preferred);
|
||||
$similarTypes = array_intersect($extensions, $preferredTypes);
|
||||
if (count($similarTypes) === 1 && !in_array('html', $preferredTypes)) {
|
||||
$this->ext = $similarTypes[0];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The startup method of the RequestHandler enables several automatic behaviors
|
||||
* related to the detection of certain properties of the HTTP request, including:
|
||||
|
@ -455,7 +473,7 @@ class RequestHandlerComponent extends Component {
|
|||
|
||||
/**
|
||||
* 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 single content-type that the client most likely prefers is returned. If $type is
|
||||
* an array, the first item in the array that the client accepts is returned.
|
||||
* Preference is determined primarily by the file extension parsed by the Router
|
||||
* if provided, and secondarily by the list of content-types provided in
|
||||
|
@ -464,7 +482,10 @@ class RequestHandlerComponent extends Component {
|
|||
* @param mixed $type An optional array of 'friendly' content-type names, i.e.
|
||||
* 'html', 'xml', 'js', etc.
|
||||
* @return mixed If $type is null or not provided, the first content-type in the
|
||||
* list, based on preference, is returned.
|
||||
* list, based on preference, is returned. If a single type is provided
|
||||
* a boolean will be returnend if that type is preferred.
|
||||
* If an array of types are provided then the first preferred type is returned.
|
||||
* If no type is provided the first preferred type is returned.
|
||||
* @see RequestHandlerComponent::setContent()
|
||||
*/
|
||||
public function prefers($type = null) {
|
||||
|
@ -553,6 +574,7 @@ class RequestHandlerComponent extends Component {
|
|||
);
|
||||
|
||||
if (!$isAdded) {
|
||||
App::uses('AppHelper', 'View/Helper');
|
||||
App::uses($helper . 'Helper', 'View/Helper');
|
||||
if (class_exists($helper . 'Helper')) {
|
||||
$controller->helpers[] = $helper;
|
||||
|
|
|
@ -25,7 +25,7 @@ App::uses('Security', 'Utility');
|
|||
* SecurityComponent
|
||||
*
|
||||
* @package Cake.Controller.Component
|
||||
* @link http://book.cakephp.org/view/1296/Security-Component
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/security-component.html
|
||||
*/
|
||||
class SecurityComponent extends Component {
|
||||
|
||||
|
@ -214,7 +214,7 @@ class SecurityComponent extends Component {
|
|||
* Sets the actions that require a POST request, or empty for all actions
|
||||
*
|
||||
* @return void
|
||||
* @link http://book.cakephp.org/view/1299/requirePost
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/security-component.html#SecurityComponent::requirePost
|
||||
*/
|
||||
public function requirePost() {
|
||||
$args = func_get_args();
|
||||
|
@ -255,7 +255,7 @@ class SecurityComponent extends Component {
|
|||
* Sets the actions that require a request that is SSL-secured, or empty for all actions
|
||||
*
|
||||
* @return void
|
||||
* @link http://book.cakephp.org/view/1300/requireSecure
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/security-component.html#SecurityComponent::requireSecure
|
||||
*/
|
||||
public function requireSecure() {
|
||||
$args = func_get_args();
|
||||
|
@ -266,7 +266,7 @@ class SecurityComponent extends Component {
|
|||
* Sets the actions that require an authenticated request, or empty for all actions
|
||||
*
|
||||
* @return void
|
||||
* @link http://book.cakephp.org/view/1301/requireAuth
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/security-component.html#SecurityComponent::requireAuth
|
||||
*/
|
||||
public function requireAuth() {
|
||||
$args = func_get_args();
|
||||
|
@ -281,7 +281,7 @@ class SecurityComponent extends Component {
|
|||
* @param string $error Error method
|
||||
* @return mixed If specified, controller blackHoleCallback's response, or no return otherwise
|
||||
* @see SecurityComponent::$blackHoleCallback
|
||||
* @link http://book.cakephp.org/view/1307/blackHole-object-controller-string-error
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/security-component.html#handling-blackhole-callbacks
|
||||
*/
|
||||
public function blackHole($controller, $error = '') {
|
||||
if ($this->blackHoleCallback == null) {
|
||||
|
|
|
@ -26,8 +26,8 @@ App::uses('CakeSession', 'Model/Datasource');
|
|||
* Session handling from the controller.
|
||||
*
|
||||
* @package Cake.Controller.Component
|
||||
* @link http://book.cakephp.org/view/1310/Sessions
|
||||
*
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/sessions.html
|
||||
* @link http://book.cakephp.org/2.0/en/development/sessions.html
|
||||
*/
|
||||
class SessionComponent extends Component {
|
||||
|
||||
|
@ -50,7 +50,7 @@ class SessionComponent extends Component {
|
|||
* This should be in a Controller.key format for better organizing
|
||||
* @param string $value The value you want to store in a session.
|
||||
* @return boolean Success
|
||||
* @link http://book.cakephp.org/view/1312/write
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/sessions.html#SessionComponent::write
|
||||
*/
|
||||
public function write($name, $value = null) {
|
||||
return CakeSession::write($name, $value);
|
||||
|
@ -64,7 +64,7 @@ class SessionComponent extends Component {
|
|||
*
|
||||
* @param string $name the name of the session key you want to read
|
||||
* @return mixed value from the session vars
|
||||
* @link http://book.cakephp.org/view/1314/read
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/sessions.html#SessionComponent::read
|
||||
*/
|
||||
public function read($name = null) {
|
||||
return CakeSession::read($name);
|
||||
|
@ -77,7 +77,7 @@ class SessionComponent extends Component {
|
|||
*
|
||||
* @param string $name the name of the session key you want to delete
|
||||
* @return boolean true is session variable is set and can be deleted, false is variable was not set.
|
||||
* @link http://book.cakephp.org/view/1316/delete
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/sessions.html#SessionComponent::delete
|
||||
*/
|
||||
public function delete($name) {
|
||||
return CakeSession::delete($name);
|
||||
|
@ -90,7 +90,7 @@ class SessionComponent extends Component {
|
|||
*
|
||||
* @param string $name the name of the session key you want to check
|
||||
* @return boolean true is session variable is set, false if not
|
||||
* @link http://book.cakephp.org/view/1315/check
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/sessions.html#SessionComponent::check
|
||||
*/
|
||||
public function check($name) {
|
||||
return CakeSession::check($name);
|
||||
|
@ -102,7 +102,6 @@ class SessionComponent extends Component {
|
|||
* In your controller: $this->Session->error();
|
||||
*
|
||||
* @return string Last session error
|
||||
* @link http://book.cakephp.org/view/1318/error
|
||||
*/
|
||||
public function error() {
|
||||
return CakeSession::error();
|
||||
|
@ -122,7 +121,7 @@ class SessionComponent extends Component {
|
|||
* @param array $params Parameters to be sent to layout as view variables
|
||||
* @param string $key Message key, default is 'flash'
|
||||
* @return void
|
||||
* @link http://book.cakephp.org/view/1313/setFlash
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/sessions.html#creating-notification-messages
|
||||
*/
|
||||
public function setFlash($message, $element = 'default', $params = array(), $key = 'flash') {
|
||||
CakeSession::write('Message.' . $key, compact('message', 'element', 'params'));
|
||||
|
@ -156,7 +155,7 @@ class SessionComponent extends Component {
|
|||
* In your controller: $this->Session->destroy();
|
||||
*
|
||||
* @return void
|
||||
* @link http://book.cakephp.org/view/1317/destroy
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/sessions.html#SessionComponent::destroy
|
||||
*/
|
||||
public function destroy() {
|
||||
return CakeSession::destroy();
|
||||
|
|
|
@ -73,7 +73,7 @@ class ComponentCollection extends ObjectCollection {
|
|||
* @param string $component Component name to load
|
||||
* @param array $settings Settings for the component.
|
||||
* @return Component A component object, Either the existing loaded component or a new one.
|
||||
* @throws MissingComponentFileException, MissingComponentClassException when the component could not be found
|
||||
* @throws MissingComponentException when the component could not be found
|
||||
*/
|
||||
public function load($component, $settings = array()) {
|
||||
if (is_array($settings) && isset($settings['className'])) {
|
||||
|
@ -90,8 +90,7 @@ class ComponentCollection extends ObjectCollection {
|
|||
$componentClass = $name . 'Component';
|
||||
App::uses($componentClass, $plugin . 'Controller/Component');
|
||||
if (!class_exists($componentClass)) {
|
||||
throw new MissingComponentClassException(array(
|
||||
'file' => Inflector::underscore($componentClass) . '.php',
|
||||
throw new MissingComponentException(array(
|
||||
'class' => $componentClass
|
||||
));
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ App::uses('View', 'View');
|
|||
* @property RequestHandlerComponent $RequestHandler
|
||||
* @property SecurityComponent $Security
|
||||
* @property SessionComponent $Session
|
||||
* @link http://book.cakephp.org/view/956/Introduction
|
||||
* @link http://book.cakephp.org/2.0/en/controllers.html
|
||||
*/
|
||||
class Controller extends Object {
|
||||
|
||||
|
@ -63,7 +63,7 @@ class Controller extends Object {
|
|||
* The name of this controller. Controller names are plural, named after the model they manipulate.
|
||||
*
|
||||
* @var string
|
||||
* @link http://book.cakephp.org/view/959/Controller-Attributes
|
||||
* @link http://book.cakephp.org/2.0/en/controllers.html#controller-attributes
|
||||
*/
|
||||
public $name = null;
|
||||
|
||||
|
@ -76,7 +76,7 @@ class Controller extends Object {
|
|||
* use no models and prevent the merging of $uses with AppController
|
||||
*
|
||||
* @var mixed A single name as a string or a list of names as an array.
|
||||
* @link http://book.cakephp.org/view/961/components-helpers-and-uses
|
||||
* @link http://book.cakephp.org/2.0/en/controllers.html#components-helpers-and-uses
|
||||
*/
|
||||
public $uses = false;
|
||||
|
||||
|
@ -87,7 +87,7 @@ class Controller extends Object {
|
|||
* Example: `public $helpers = array('Html', 'Javascript', 'Time', 'Ajax');`
|
||||
*
|
||||
* @var mixed A single name as a string or a list of names as an array.
|
||||
* @link http://book.cakephp.org/view/961/components-helpers-and-uses
|
||||
* @link http://book.cakephp.org/2.0/en/controllers.html#components-helpers-and-uses
|
||||
*/
|
||||
public $helpers = array('Session', 'Html', 'Form');
|
||||
|
||||
|
@ -141,7 +141,6 @@ class Controller extends Object {
|
|||
* is the filename in /app/View/<SubFolder> without the .ctp extension.
|
||||
*
|
||||
* @var string
|
||||
* @link http://book.cakephp.org/view/962/Page-related-Attributes-layout-and-pageTitle
|
||||
*/
|
||||
public $view = null;
|
||||
|
||||
|
@ -151,7 +150,6 @@ class Controller extends Object {
|
|||
* extension.
|
||||
*
|
||||
* @var string
|
||||
* @link http://book.cakephp.org/view/962/Page-related-Attributes-layout-and-pageTitle
|
||||
*/
|
||||
public $layout = 'default';
|
||||
|
||||
|
@ -463,9 +461,8 @@ class Controller extends Object {
|
|||
* @throws PrivateActionException, MissingActionException
|
||||
*/
|
||||
public function invokeAction(CakeRequest $request) {
|
||||
$reflection = new ReflectionClass($this);
|
||||
try {
|
||||
$method = $reflection->getMethod($request->params['action']);
|
||||
$method = new ReflectionMethod($this, $request->params['action']);
|
||||
|
||||
if ($this->_isPrivateAction($method, $request)) {
|
||||
throw new PrivateActionException(array(
|
||||
|
@ -580,7 +577,7 @@ class Controller extends Object {
|
|||
*
|
||||
* @return mixed true if models found and instance created.
|
||||
* @see Controller::loadModel()
|
||||
* @link http://book.cakephp.org/view/977/Controller-Methods#constructClasses-986
|
||||
* @link http://book.cakephp.org/2.0/en/controllers.html#Controller::constructClasses
|
||||
* @throws MissingModelException
|
||||
*/
|
||||
public function constructClasses() {
|
||||
|
@ -686,7 +683,7 @@ class Controller extends Object {
|
|||
* @param integer $status Optional HTTP status code (eg: 404)
|
||||
* @param boolean $exit If true, exit() will be called after the redirect
|
||||
* @return mixed void if $exit = false. Terminates script if $exit = true
|
||||
* @link http://book.cakephp.org/view/982/redirect
|
||||
* @link http://book.cakephp.org/2.0/en/controllers.html#Controller::redirect
|
||||
*/
|
||||
public function redirect($url, $status = null, $exit = true) {
|
||||
$this->autoRender = false;
|
||||
|
@ -776,7 +773,7 @@ class Controller extends Object {
|
|||
* @param mixed $two Value in case $one is a string (which then works as the key).
|
||||
* Unused if $one is an associative array, otherwise serves as the values to $one's keys.
|
||||
* @return void
|
||||
* @link http://book.cakephp.org/view/979/set
|
||||
* @link http://book.cakephp.org/2.0/en/controllers.html#interacting-with-views
|
||||
*/
|
||||
public function set($one, $two = null) {
|
||||
if (is_array($one)) {
|
||||
|
@ -861,7 +858,7 @@ class Controller extends Object {
|
|||
* @param string $view View to use for rendering
|
||||
* @param string $layout Layout to use
|
||||
* @return CakeResponse A response object containing the rendered view.
|
||||
* @link http://book.cakephp.org/view/980/render
|
||||
* @link http://book.cakephp.org/2.0/en/controllers.html#Controller::render
|
||||
*/
|
||||
public function render($view = null, $layout = null) {
|
||||
$this->beforeRender();
|
||||
|
@ -908,7 +905,7 @@ class Controller extends Object {
|
|||
* @param string $default Default URL to use if HTTP_REFERER cannot be read from headers
|
||||
* @param boolean $local If true, restrict referring URLs to local server
|
||||
* @return string Referring URL
|
||||
* @link http://book.cakephp.org/view/987/referer
|
||||
* @link http://book.cakephp.org/2.0/en/controllers.html#Controller::referer
|
||||
*/
|
||||
public function referer($default = null, $local = false) {
|
||||
if ($this->request) {
|
||||
|
@ -925,7 +922,7 @@ class Controller extends Object {
|
|||
* Forces the user's browser not to cache the results of the current request.
|
||||
*
|
||||
* @return void
|
||||
* @link http://book.cakephp.org/view/988/disableCache
|
||||
* @link http://book.cakephp.org/2.0/en/controllers.html#Controller::disableCache
|
||||
* @deprecated Use CakeResponse::disableCache()
|
||||
*/
|
||||
public function disableCache() {
|
||||
|
@ -942,7 +939,7 @@ class Controller extends Object {
|
|||
* @param integer $pause Time to show the message
|
||||
* @param string $layout Layout you want to use, defaults to 'flash'
|
||||
* @return void Renders flash layout
|
||||
* @link http://book.cakephp.org/view/983/flash
|
||||
* @link http://book.cakephp.org/2.0/en/controllers.html#Controller::flash
|
||||
*/
|
||||
public function flash($message, $url, $pause = 1, $layout = 'flash') {
|
||||
$this->autoRender = false;
|
||||
|
@ -963,7 +960,7 @@ class Controller extends Object {
|
|||
* @param boolean $exclusive If true, and $op is an array, fields not included in $op will not be
|
||||
* included in the returned conditions
|
||||
* @return array An array of model conditions
|
||||
* @link http://book.cakephp.org/view/989/postConditions
|
||||
* @deprecated
|
||||
*/
|
||||
public function postConditions($data = array(), $op = null, $bool = 'AND', $exclusive = false) {
|
||||
if (!is_array($data) || empty($data)) {
|
||||
|
@ -1019,7 +1016,7 @@ class Controller extends Object {
|
|||
* @param mixed $scope Conditions to use while paginating
|
||||
* @param array $whitelist List of allowed options for paging
|
||||
* @return array Model query results
|
||||
* @link http://book.cakephp.org/view/1232/Controller-Setup
|
||||
* @link http://book.cakephp.org/2.0/en/controllers.html#Controller::paginate
|
||||
* @deprecated Use PaginatorComponent instead
|
||||
*/
|
||||
public function paginate($object = null, $scope = array(), $whitelist = array()) {
|
||||
|
@ -1031,7 +1028,7 @@ class Controller extends Object {
|
|||
* or perform logic that needs to happen before each controller action.
|
||||
*
|
||||
* @return void
|
||||
* @link http://book.cakephp.org/view/984/Callbacks
|
||||
* @link http://book.cakephp.org/2.0/en/controllers.html#request-life-cycle-callbacks
|
||||
*/
|
||||
public function beforeFilter() {
|
||||
}
|
||||
|
@ -1041,7 +1038,7 @@ class Controller extends Object {
|
|||
* to perform logic or set view variables that are required on every request.
|
||||
*
|
||||
* @return void
|
||||
* @link http://book.cakephp.org/view/984/Callbacks
|
||||
* @link http://book.cakephp.org/2.0/en/controllers.html#request-life-cycle-callbacks
|
||||
*/
|
||||
public function beforeRender() {
|
||||
}
|
||||
|
@ -1058,6 +1055,7 @@ class Controller extends Object {
|
|||
* @param integer $status Optional HTTP status code (eg: 404)
|
||||
* @param boolean $exit If true, exit() will be called after the redirect
|
||||
* @return boolean
|
||||
* @link http://book.cakephp.org/2.0/en/controllers.html#request-life-cycle-callbacks
|
||||
*/
|
||||
public function beforeRedirect($url, $status = null, $exit = true) {
|
||||
return true;
|
||||
|
@ -1067,7 +1065,7 @@ class Controller extends Object {
|
|||
* Called after the controller action is run and rendered.
|
||||
*
|
||||
* @return void
|
||||
* @link http://book.cakephp.org/view/984/Callbacks
|
||||
* @link http://book.cakephp.org/2.0/en/controllers.html#request-life-cycle-callbacks
|
||||
*/
|
||||
public function afterFilter() {
|
||||
}
|
||||
|
@ -1077,7 +1075,7 @@ class Controller extends Object {
|
|||
*
|
||||
* @param string $method name of method called example index, edit, etc.
|
||||
* @return boolean Success
|
||||
* @link http://book.cakephp.org/view/984/Callbacks
|
||||
* @link http://book.cakephp.org/2.0/en/controllers.html#callbacks
|
||||
*/
|
||||
public function beforeScaffold($method) {
|
||||
return true;
|
||||
|
@ -1100,7 +1098,7 @@ class Controller extends Object {
|
|||
*
|
||||
* @param string $method name of method called either edit or update.
|
||||
* @return boolean Success
|
||||
* @link http://book.cakephp.org/view/984/Callbacks
|
||||
* @link http://book.cakephp.org/2.0/en/controllers.html#callbacks
|
||||
*/
|
||||
public function afterScaffoldSave($method) {
|
||||
return true;
|
||||
|
@ -1123,7 +1121,7 @@ class Controller extends Object {
|
|||
*
|
||||
* @param string $method name of method called either edit or update.
|
||||
* @return boolean Success
|
||||
* @link http://book.cakephp.org/view/984/Callbacks
|
||||
* @link http://book.cakephp.org/2.0/en/controllers.html#callbacks
|
||||
*/
|
||||
public function afterScaffoldSaveError($method) {
|
||||
return true;
|
||||
|
@ -1148,7 +1146,7 @@ class Controller extends Object {
|
|||
*
|
||||
* @param string $method name of method called example index, edit, etc.
|
||||
* @return boolean Success
|
||||
* @link http://book.cakephp.org/view/984/Callbacks
|
||||
* @link http://book.cakephp.org/2.0/en/controllers.html#callbacks
|
||||
*/
|
||||
public function scaffoldError($method) {
|
||||
return false;
|
||||
|
|
|
@ -27,7 +27,7 @@ App::uses('AppController', 'Controller');
|
|||
* Override this controller by placing a copy in controllers directory of an application
|
||||
*
|
||||
* @package Cake.Controller
|
||||
* @link http://book.cakephp.org/view/958/The-Pages-Controller
|
||||
* @link http://book.cakephp.org/2.0/en/controllers/pages-controller.html
|
||||
*/
|
||||
class PagesController extends AppController {
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ class Scaffold {
|
|||
public $request;
|
||||
|
||||
/**
|
||||
* valid session.
|
||||
* Valid session.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
|
@ -125,7 +125,7 @@ class Scaffold {
|
|||
$this->ScaffoldModel = $this->controller->{$this->modelClass};
|
||||
$this->scaffoldTitle = Inflector::humanize(Inflector::underscore($this->viewPath));
|
||||
$this->scaffoldActions = $controller->scaffold;
|
||||
$title_for_layout = __d('cake', 'Scaffold :: ') . Inflector::humanize($request->action) . ' :: ' . $this->scaffoldTitle;
|
||||
$title_for_layout = __d('cake_dev', 'Scaffold :: ') . Inflector::humanize($request->action) . ' :: ' . $this->scaffoldTitle;
|
||||
$modelClass = $this->controller->modelClass;
|
||||
$primaryKey = $this->ScaffoldModel->primaryKey;
|
||||
$displayField = $this->ScaffoldModel->displayField;
|
||||
|
@ -163,7 +163,7 @@ class Scaffold {
|
|||
$this->ScaffoldModel->id = $request->params['pass'][0];
|
||||
}
|
||||
if (!$this->ScaffoldModel->exists()) {
|
||||
throw new NotFoundException(__d('cake', 'Invalid %s', Inflector::humanize($this->modelKey)));
|
||||
throw new NotFoundException(__d('cake_dev', 'Invalid %s', Inflector::humanize($this->modelKey)));
|
||||
}
|
||||
$this->ScaffoldModel->recursive = 1;
|
||||
$this->controller->request->data = $this->ScaffoldModel->read();
|
||||
|
@ -218,10 +218,10 @@ class Scaffold {
|
|||
*/
|
||||
protected function _scaffoldSave(CakeRequest $request, $action = 'edit') {
|
||||
$formAction = 'edit';
|
||||
$success = __d('cake', 'updated');
|
||||
$success = __d('cake_dev', 'updated');
|
||||
if ($action === 'add') {
|
||||
$formAction = 'add';
|
||||
$success = __d('cake', 'saved');
|
||||
$success = __d('cake_dev', 'saved');
|
||||
}
|
||||
|
||||
if ($this->controller->beforeScaffold($action)) {
|
||||
|
@ -230,7 +230,7 @@ class Scaffold {
|
|||
$this->ScaffoldModel->id = $request['pass'][0];
|
||||
}
|
||||
if (!$this->ScaffoldModel->exists()) {
|
||||
throw new NotFoundException(__d('cake', 'Invalid %s', Inflector::humanize($this->modelKey)));
|
||||
throw new NotFoundException(__d('cake_dev', 'Invalid %s', Inflector::humanize($this->modelKey)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -241,7 +241,7 @@ class Scaffold {
|
|||
|
||||
if ($this->ScaffoldModel->save($request->data)) {
|
||||
if ($this->controller->afterScaffoldSave($action)) {
|
||||
$message = __d('cake',
|
||||
$message = __d('cake_dev',
|
||||
'The %1$s has been %2$s',
|
||||
Inflector::humanize($this->modelKey),
|
||||
$success
|
||||
|
@ -252,7 +252,7 @@ class Scaffold {
|
|||
}
|
||||
} else {
|
||||
if ($this->_validSession) {
|
||||
$this->controller->Session->setFlash(__d('cake', 'Please correct errors below.'));
|
||||
$this->controller->Session->setFlash(__d('cake_dev', 'Please correct errors below.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -300,13 +300,13 @@ class Scaffold {
|
|||
}
|
||||
$this->ScaffoldModel->id = $id;
|
||||
if (!$this->ScaffoldModel->exists()) {
|
||||
throw new NotFoundException(__d('cake', 'Invalid %s', Inflector::humanize($this->modelClass)));
|
||||
throw new NotFoundException(__d('cake_dev', 'Invalid %s', Inflector::humanize($this->modelClass)));
|
||||
}
|
||||
if ($this->ScaffoldModel->delete()) {
|
||||
$message = __d('cake', 'The %1$s with id: %2$d has been deleted.', Inflector::humanize($this->modelClass), $id);
|
||||
$message = __d('cake_dev', 'The %1$s with id: %2$d has been deleted.', Inflector::humanize($this->modelClass), $id);
|
||||
return $this->_sendMessage($message);
|
||||
} else {
|
||||
$message = __d('cake',
|
||||
$message = __d('cake_dev',
|
||||
'There was an error deleting the %1$s with id: %2$d',
|
||||
Inflector::humanize($this->modelClass),
|
||||
$id
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
* You can inspect the currently loaded paths using `App::path('Controller')` for example to see loaded
|
||||
* controller paths.
|
||||
*
|
||||
* It is also possible to inspect paths for plugin classes, for instance, to see a plugin's helpers you would call
|
||||
* It is also possible to inspect paths for plugin classes, for instance, to see a plugin's helpers you would call
|
||||
* `App::path('View/Helper', 'MyPlugin')`
|
||||
*
|
||||
* ### Locating plugins and themes
|
||||
|
@ -57,7 +57,7 @@
|
|||
* You can find out which objects App knows about using App::objects('Controller') for example to find
|
||||
* which application controllers App knows about.
|
||||
*
|
||||
* @link http://book.cakephp.org/view/933/The-App-Class
|
||||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/app.html
|
||||
* @package Cake.Core
|
||||
*/
|
||||
class App {
|
||||
|
@ -214,8 +214,9 @@ class App {
|
|||
if (!empty($plugin)) {
|
||||
$path = array();
|
||||
$pluginPath = self::pluginPath($plugin);
|
||||
if (!empty(self::$_packageFormat[$type])) {
|
||||
foreach (self::$_packageFormat[$type] as $f) {
|
||||
$packageFormat= self::_packageFormat();
|
||||
if (!empty($packageFormat[$type])) {
|
||||
foreach ($packageFormat[$type] as $f) {
|
||||
$path[] = sprintf($f, $pluginPath);
|
||||
}
|
||||
}
|
||||
|
@ -251,7 +252,7 @@ class App {
|
|||
*
|
||||
* `App::build(array('Model' => array('/path/to/models/')), App::RESET); will setup the path as the only valid path for searching models`
|
||||
*
|
||||
* `App::build(array('View/Helper' => array('/path/to/helpers/', '/another/path/))); will setup multiple search paths for helpers`
|
||||
* `App::build(array('View/Helper' => array('/path/to/helpers/', '/another/path/'))); will setup multiple search paths for helpers`
|
||||
*
|
||||
* If reset is set to true, all loaded plugins will be forgotten and they will be needed to be loaded again.
|
||||
*
|
||||
|
@ -260,88 +261,6 @@ class App {
|
|||
* @return void
|
||||
*/
|
||||
public static function build($paths = array(), $mode = App::PREPEND) {
|
||||
if (empty(self::$_packageFormat)) {
|
||||
self::$_packageFormat = array(
|
||||
'Model' => array(
|
||||
'%s' . 'Model' . DS,
|
||||
'%s' . 'models' . DS
|
||||
),
|
||||
'Model/Behavior' => array(
|
||||
'%s' . 'Model' . DS . 'Behavior' . DS,
|
||||
'%s' . 'models' . DS . 'behaviors' . DS
|
||||
),
|
||||
'Model/Datasource' => array(
|
||||
'%s' . 'Model' . DS . 'Datasource' . DS,
|
||||
'%s' . 'models' . DS . 'datasources' . DS
|
||||
),
|
||||
'Model/Datasource/Database' => array(
|
||||
'%s' . 'Model' . DS . 'Datasource' . DS . 'Database' . DS,
|
||||
'%s' . 'models' . DS . 'datasources' . DS . 'database' . DS
|
||||
),
|
||||
'Model/Datasource/Session' => array(
|
||||
'%s' . 'Model' . DS . 'Datasource' . DS . 'Session' . DS,
|
||||
'%s' . 'models' . DS . 'datasources' . DS . 'session' . DS
|
||||
),
|
||||
'Controller' => array(
|
||||
'%s' . 'Controller' . DS,
|
||||
'%s' . 'controllers' . DS
|
||||
),
|
||||
'Controller/Component' => array(
|
||||
'%s' . 'Controller' . DS . 'Component' . DS,
|
||||
'%s' . 'controllers' . DS . 'components' . DS
|
||||
),
|
||||
'Controller/Component/Auth' => array(
|
||||
'%s' . 'Controller' . DS . 'Component' . DS . 'Auth' . DS,
|
||||
'%s' . 'controllers' . DS . 'components' . DS . 'auth' . DS
|
||||
),
|
||||
'View' => array(
|
||||
'%s' . 'View' . DS,
|
||||
'%s' . 'views' . DS
|
||||
),
|
||||
'View/Helper' => array(
|
||||
'%s' . 'View' . DS . 'Helper' . DS,
|
||||
'%s' . 'views' . DS . 'helpers' . DS
|
||||
),
|
||||
'Console' => array(
|
||||
'%s' . 'Console' . DS,
|
||||
'%s' . 'console' . DS
|
||||
),
|
||||
'Console/Command' => array(
|
||||
'%s' . 'Console' . DS . 'Command' . DS,
|
||||
'%s' . 'console' . DS . 'shells' . DS,
|
||||
),
|
||||
'Console/Command/Task' => array(
|
||||
'%s' . 'Console' . DS . 'Command' . DS . 'Task' . DS,
|
||||
'%s' . 'console' . DS . 'shells' . DS . 'tasks' . DS
|
||||
),
|
||||
'Lib' => array(
|
||||
'%s' . 'Lib' . DS,
|
||||
'%s' . 'libs' . DS
|
||||
),
|
||||
'locales' => array(
|
||||
'%s' . 'Locale' . DS,
|
||||
'%s' . 'locale' . DS
|
||||
),
|
||||
'Vendor' => array('%s' . 'Vendor' . DS, VENDORS),
|
||||
'Plugin' => array(
|
||||
APP . 'Plugin' . DS,
|
||||
APP . 'plugins' . DS,
|
||||
dirname(dirname(CAKE)) . DS . 'plugins' . DS,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if ($mode === App::RESET) {
|
||||
foreach ($paths as $type => $new) {
|
||||
if (!empty(self::$legacy[$type])) {
|
||||
$type = self::$legacy[$type];
|
||||
}
|
||||
self::$_packages[$type] = (array)$new;
|
||||
self::objects($type, null, false);
|
||||
}
|
||||
return $paths;
|
||||
}
|
||||
|
||||
//Provides Backwards compatibility for old-style package names
|
||||
$legacyPaths = array();
|
||||
foreach ($paths as $type => $path) {
|
||||
|
@ -350,31 +269,48 @@ class App {
|
|||
}
|
||||
$legacyPaths[$type] = $path;
|
||||
}
|
||||
|
||||
$paths = $legacyPaths;
|
||||
|
||||
if ($mode === App::RESET) {
|
||||
foreach ($paths as $type => $new) {
|
||||
self::$_packages[$type] = (array)$new;
|
||||
self::objects($type, null, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
$packageFormat = self::_packageFormat();
|
||||
|
||||
$defaults = array();
|
||||
foreach (self::$_packageFormat as $package => $format) {
|
||||
foreach ($packageFormat as $package => $format) {
|
||||
foreach ($format as $f) {
|
||||
$defaults[$package][] = sprintf($f, APP);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($defaults as $type => $default) {
|
||||
if (empty(self::$_packages[$type]) || empty($paths)) {
|
||||
self::$_packages[$type] = $default;
|
||||
}
|
||||
if (empty($paths)) {
|
||||
self::$_packages = $defaults;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty($paths[$type])) {
|
||||
if ($mode === App::PREPEND) {
|
||||
$path = array_merge((array)$paths[$type], self::$_packages[$type]);
|
||||
} else {
|
||||
$path = array_merge(self::$_packages[$type], (array)$paths[$type]);
|
||||
}
|
||||
} else {
|
||||
foreach ($defaults as $type => $default) {
|
||||
if (!empty(self::$_packages[$type])) {
|
||||
$path = self::$_packages[$type];
|
||||
}
|
||||
|
||||
self::$_packages[$type] = array_values(array_unique($path));
|
||||
if (!empty($paths[$type])) {
|
||||
$newPath = (array)$paths[$type];
|
||||
|
||||
if ($mode === App::PREPEND) {
|
||||
$path = array_merge($newPath, $path);
|
||||
} else {
|
||||
$path = array_merge($path, $newPath);
|
||||
}
|
||||
|
||||
$path = array_values(array_unique($path));
|
||||
}
|
||||
|
||||
self::$_packages[$type] = $path;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -616,7 +552,7 @@ class App {
|
|||
* Finds classes based on $name or specific file(s) to search. Calling App::import() will
|
||||
* not construct any classes contained in the files. It will only find and require() the file.
|
||||
*
|
||||
* @link http://book.cakephp.org/view/934/Using-App-import
|
||||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/app.html#including-files-with-app-import
|
||||
* @param mixed $type The type of Class if passed as a string, or all params can be passed as
|
||||
* an single array to $type,
|
||||
* @param string $name Name of the Class or a unique name for the file
|
||||
|
@ -846,6 +782,83 @@ class App {
|
|||
return false;
|
||||
}
|
||||
|
||||
protected static function _packageFormat() {
|
||||
if (empty(self::$_packageFormat)) {
|
||||
self::$_packageFormat = array(
|
||||
'Model' => array(
|
||||
'%s' . 'Model' . DS,
|
||||
'%s' . 'models' . DS
|
||||
),
|
||||
'Model/Behavior' => array(
|
||||
'%s' . 'Model' . DS . 'Behavior' . DS,
|
||||
'%s' . 'models' . DS . 'behaviors' . DS
|
||||
),
|
||||
'Model/Datasource' => array(
|
||||
'%s' . 'Model' . DS . 'Datasource' . DS,
|
||||
'%s' . 'models' . DS . 'datasources' . DS
|
||||
),
|
||||
'Model/Datasource/Database' => array(
|
||||
'%s' . 'Model' . DS . 'Datasource' . DS . 'Database' . DS,
|
||||
'%s' . 'models' . DS . 'datasources' . DS . 'database' . DS
|
||||
),
|
||||
'Model/Datasource/Session' => array(
|
||||
'%s' . 'Model' . DS . 'Datasource' . DS . 'Session' . DS,
|
||||
'%s' . 'models' . DS . 'datasources' . DS . 'session' . DS
|
||||
),
|
||||
'Controller' => array(
|
||||
'%s' . 'Controller' . DS,
|
||||
'%s' . 'controllers' . DS
|
||||
),
|
||||
'Controller/Component' => array(
|
||||
'%s' . 'Controller' . DS . 'Component' . DS,
|
||||
'%s' . 'controllers' . DS . 'components' . DS
|
||||
),
|
||||
'Controller/Component/Auth' => array(
|
||||
'%s' . 'Controller' . DS . 'Component' . DS . 'Auth' . DS,
|
||||
'%s' . 'controllers' . DS . 'components' . DS . 'auth' . DS
|
||||
),
|
||||
'View' => array(
|
||||
'%s' . 'View' . DS,
|
||||
'%s' . 'views' . DS
|
||||
),
|
||||
'View/Helper' => array(
|
||||
'%s' . 'View' . DS . 'Helper' . DS,
|
||||
'%s' . 'views' . DS . 'helpers' . DS
|
||||
),
|
||||
'Console' => array(
|
||||
'%s' . 'Console' . DS,
|
||||
'%s' . 'console' . DS
|
||||
),
|
||||
'Console/Command' => array(
|
||||
'%s' . 'Console' . DS . 'Command' . DS,
|
||||
'%s' . 'console' . DS . 'shells' . DS,
|
||||
),
|
||||
'Console/Command/Task' => array(
|
||||
'%s' . 'Console' . DS . 'Command' . DS . 'Task' . DS,
|
||||
'%s' . 'console' . DS . 'shells' . DS . 'tasks' . DS
|
||||
),
|
||||
'Lib' => array(
|
||||
'%s' . 'Lib' . DS,
|
||||
'%s' . 'libs' . DS
|
||||
),
|
||||
'locales' => array(
|
||||
'%s' . 'Locale' . DS,
|
||||
'%s' . 'locale' . DS
|
||||
),
|
||||
'Vendor' => array(
|
||||
'%s' . 'Vendor' . DS, VENDORS
|
||||
),
|
||||
'Plugin' => array(
|
||||
APP . 'Plugin' . DS,
|
||||
APP . 'plugins' . DS,
|
||||
dirname(dirname(CAKE)) . DS . 'plugins' . DS
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return self::$_packageFormat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Object destructor.
|
||||
*
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
* CakePlugin class
|
||||
*
|
||||
* @package Cake.Core
|
||||
* @link http://book.cakephp.org/2.0/en/plugins.html
|
||||
*/
|
||||
class CakePlugin {
|
||||
|
||||
|
@ -117,7 +118,7 @@ class CakePlugin {
|
|||
* @param array $options
|
||||
* @return void
|
||||
*/
|
||||
public function loadAll($options = array()) {
|
||||
public static function loadAll($options = array()) {
|
||||
$plugins = App::objects('plugins');
|
||||
foreach ($plugins as $p) {
|
||||
$opts = isset($options[$p]) ? $options[$p] : null;
|
||||
|
|
|
@ -27,7 +27,7 @@ App::uses('Set', 'Utility');
|
|||
* for future use.
|
||||
*
|
||||
* @package Cake.Core
|
||||
* @link http://book.cakephp.org/view/924/The-Configuration-Class
|
||||
* @link http://book.cakephp.org/2.0/en/development/configuration.html#configure-class
|
||||
*/
|
||||
class Configure {
|
||||
|
||||
|
@ -113,7 +113,7 @@ class Configure {
|
|||
* ));
|
||||
* }}}
|
||||
*
|
||||
* @link http://book.cakephp.org/view/926/write
|
||||
* @link http://book.cakephp.org/2.0/en/development/configuration.html#Configure::write
|
||||
* @param array $config Name of var to write
|
||||
* @param mixed $value Value to set for var
|
||||
* @return boolean True if write was successful
|
||||
|
@ -166,7 +166,7 @@ class Configure {
|
|||
* Configure::read('Name.key'); will return only the value of Configure::Name[key]
|
||||
* }}}
|
||||
*
|
||||
* @link http://book.cakephp.org/view/927/read
|
||||
* @linkhttp://book.cakephp.org/2.0/en/development/configuration.html#Configure::read
|
||||
* @param string $var Variable to obtain. Use '.' to access array elements.
|
||||
* @return mixed value stored in configure, or null.
|
||||
*/
|
||||
|
@ -212,7 +212,7 @@ class Configure {
|
|||
* Configure::delete('Name.key'); will delete only the Configure::Name[key]
|
||||
* }}}
|
||||
*
|
||||
* @link http://book.cakephp.org/view/928/delete
|
||||
* @link http://book.cakephp.org/2.0/en/development/configuration.html#Configure::delete
|
||||
* @param string $var the var to be deleted
|
||||
* @return void
|
||||
*/
|
||||
|
@ -287,7 +287,10 @@ class Configure {
|
|||
*
|
||||
* `Configure::load('setup', 'default');`
|
||||
*
|
||||
* @link http://book.cakephp.org/view/929/load
|
||||
* If using `default` config and no reader has been configured for it yet,
|
||||
* one will be automatically created using PhpReader
|
||||
*
|
||||
* @link http://book.cakephp.org/2.0/en/development/configuration.html#Configure::load
|
||||
* @param string $key name of configuration resource to load.
|
||||
* @param string $config Name of the configured reader to use to read the resource identified by $key.
|
||||
* @param boolean $merge if config files should be merged instead of simply overridden
|
||||
|
@ -296,7 +299,12 @@ class Configure {
|
|||
*/
|
||||
public static function load($key, $config = 'default', $merge = true) {
|
||||
if (!isset(self::$_readers[$config])) {
|
||||
return false;
|
||||
if ($config === 'default') {
|
||||
App::uses('PhpReader', 'Configure');
|
||||
self::$_readers[$config] = new PhpReader();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$values = self::$_readers[$config]->read($key);
|
||||
|
||||
|
@ -317,7 +325,6 @@ class Configure {
|
|||
*
|
||||
* Usage `Configure::version();`
|
||||
*
|
||||
* @link http://book.cakephp.org/view/930/version
|
||||
* @return string Current version of CakePHP
|
||||
*/
|
||||
public static function version() {
|
||||
|
|
|
@ -65,8 +65,10 @@ class Object {
|
|||
return false;
|
||||
}
|
||||
App::uses('Dispatcher', 'Routing');
|
||||
if (in_array('return', $extra, true)) {
|
||||
$extra = array_merge($extra, array('return' => 0, 'autoRender' => 1));
|
||||
if (($index = array_search('return', $extra)) !== false) {
|
||||
$extra['return'] = 0;
|
||||
$extra['autoRender'] = 1;
|
||||
unset($extra[$index]);
|
||||
}
|
||||
if (is_array($url) && !isset($extra['url'])) {
|
||||
$extra['url'] = array();
|
||||
|
|
|
@ -157,7 +157,7 @@ class ErrorHandler {
|
|||
return false;
|
||||
}
|
||||
$errorConfig = Configure::read('Error');
|
||||
list($error, $log) = self::_mapErrorCode($code);
|
||||
list($error, $log) = self::mapErrorCode($code);
|
||||
|
||||
$debug = Configure::read('debug');
|
||||
if ($debug) {
|
||||
|
@ -189,7 +189,7 @@ class ErrorHandler {
|
|||
* @param integer $code Error code to map
|
||||
* @return array Array of error word, and log location.
|
||||
*/
|
||||
protected static function _mapErrorCode($code) {
|
||||
public static function mapErrorCode($code) {
|
||||
$error = $log = null;
|
||||
switch ($code) {
|
||||
case E_PARSE:
|
||||
|
|
|
@ -47,7 +47,7 @@ App::uses('CakeResponse', 'Network');
|
|||
*
|
||||
* Using a subclass of ExceptionRenderer gives you full control over how Exceptions are rendered, you
|
||||
* can configure your class in your core.php, with `Configure::write('Exception.renderer', 'MyClass');`
|
||||
* You should place any custom exception renderers in `app/libs`.
|
||||
* You should place any custom exception renderers in `app/Lib/Error`.
|
||||
*
|
||||
* @package Cake.Error
|
||||
*/
|
||||
|
@ -179,7 +179,7 @@ class ExceptionRenderer {
|
|||
*/
|
||||
protected function _cakeError(CakeException $error) {
|
||||
$url = $this->controller->request->here();
|
||||
$code = $error->getCode();
|
||||
$code = ($error->getCode() >= 400 && $error->getCode() < 506) ? $error->getCode() : 500;
|
||||
$this->controller->response->statusCode($code);
|
||||
$this->controller->set(array(
|
||||
'code' => $code,
|
||||
|
@ -204,7 +204,7 @@ class ExceptionRenderer {
|
|||
public function error400($error) {
|
||||
$message = $error->getMessage();
|
||||
if (Configure::read('debug') == 0 && $error instanceof CakeException) {
|
||||
$message = __d('cake', 'Not Found');
|
||||
$message = __('Not Found');
|
||||
}
|
||||
$url = $this->controller->request->here();
|
||||
$this->controller->response->statusCode($error->getCode());
|
||||
|
@ -227,7 +227,7 @@ class ExceptionRenderer {
|
|||
$code = ($error->getCode() > 500 && $error->getCode() < 506) ? $error->getCode() : 500;
|
||||
$this->controller->response->statusCode($code);
|
||||
$this->controller->set(array(
|
||||
'name' => __d('cake', 'An Internal Error Has Occurred'),
|
||||
'name' => __('An Internal Error Has Occurred'),
|
||||
'message' => h($url),
|
||||
'error' => $error,
|
||||
));
|
||||
|
@ -237,7 +237,7 @@ class ExceptionRenderer {
|
|||
/**
|
||||
* Convenience method to display a PDOException.
|
||||
*
|
||||
* @param PDOException $error
|
||||
* @param PDOException $error
|
||||
* @return void
|
||||
*/
|
||||
public function pdoError(PDOException $error) {
|
||||
|
|
|
@ -241,37 +241,23 @@ class PrivateActionException extends CakeException {
|
|||
}
|
||||
|
||||
/**
|
||||
* Used when a Component file cannot be found.
|
||||
* Used when a component cannot be found.
|
||||
*
|
||||
* @package Cake.Error
|
||||
*/
|
||||
class MissingComponentFileException extends CakeException {
|
||||
protected $_messageTemplate = 'Component file "%s" is missing.';
|
||||
class MissingComponentException extends CakeException {
|
||||
protected $_messageTemplate = 'Component class %s could not be found.';
|
||||
}
|
||||
|
||||
/**
|
||||
* Used when a Component class cannot be found.
|
||||
* Used when a behavior cannot be found.
|
||||
*
|
||||
* @package Cake.Error
|
||||
*/
|
||||
class MissingComponentClassException extends CakeException {
|
||||
protected $_messageTemplate = 'Component class "%s" is missing.';
|
||||
class MissingBehaviorException extends CakeException {
|
||||
protected $_messageTemplate = 'Behavior class %s could not be found.';
|
||||
}
|
||||
|
||||
/**
|
||||
* Used when a Behavior file cannot be found.
|
||||
*
|
||||
* @package Cake.Error
|
||||
*/
|
||||
class MissingBehaviorFileException extends CakeException { }
|
||||
|
||||
/**
|
||||
* Used when a Behavior class cannot be found.
|
||||
*
|
||||
* @package Cake.Error
|
||||
*/
|
||||
class MissingBehaviorClassException extends CakeException { }
|
||||
|
||||
/**
|
||||
* Used when a view file cannot be found.
|
||||
*
|
||||
|
@ -291,24 +277,14 @@ class MissingLayoutException extends CakeException {
|
|||
}
|
||||
|
||||
/**
|
||||
* Used when a helper file cannot be found.
|
||||
* Used when a helper cannot be found.
|
||||
*
|
||||
* @package Cake.Error
|
||||
*/
|
||||
class MissingHelperFileException extends CakeException {
|
||||
protected $_messageTemplate = 'Helper file "%s" is missing.';
|
||||
class MissingHelperException extends CakeException {
|
||||
protected $_messageTemplate = 'Helper class %s could not be found.';
|
||||
}
|
||||
|
||||
/**
|
||||
* Used when a helper class cannot be found.
|
||||
*
|
||||
* @package Cake.Error
|
||||
*/
|
||||
class MissingHelperClassException extends CakeException {
|
||||
protected $_messageTemplate = 'Helper class "%s" is missing.';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Runtime Exceptions for ConnectionManager
|
||||
*
|
||||
|
@ -328,21 +304,12 @@ class MissingConnectionException extends CakeException {
|
|||
}
|
||||
|
||||
/**
|
||||
* Used when a Task file cannot be found.
|
||||
* Used when a Task cannot be found.
|
||||
*
|
||||
* @package Cake.Error
|
||||
*/
|
||||
class MissingTaskFileException extends CakeException {
|
||||
protected $_messageTemplate = 'Task file "%s" is missing.';
|
||||
}
|
||||
|
||||
/**
|
||||
* Used when a Task class cannot be found.
|
||||
*
|
||||
* @package Cake.Error
|
||||
*/
|
||||
class MissingTaskClassException extends CakeException {
|
||||
protected $_messageTemplate = 'Task class "%s" is missing.';
|
||||
class MissingTaskException extends CakeException {
|
||||
protected $_messageTemplate = 'Task class %s could not be found.';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -355,21 +322,12 @@ class MissingShellMethodException extends CakeException {
|
|||
}
|
||||
|
||||
/**
|
||||
* Used when a shell class cannot be found.
|
||||
* Used when a shell cannot be found.
|
||||
*
|
||||
* @package Cake.Error
|
||||
*/
|
||||
class MissingShellClassException extends CakeException {
|
||||
protected $_messageTemplate = "Shell class %s could not be loaded.";
|
||||
}
|
||||
|
||||
/**
|
||||
* Used when a shell file cannot be found.
|
||||
*
|
||||
* @package Cake.Error
|
||||
*/
|
||||
class MissingShellFileException extends CakeException {
|
||||
protected $_messageTemplate = "Shell file %s could not be loaded.";
|
||||
class MissingShellException extends CakeException {
|
||||
protected $_messageTemplate = 'Shell class %s could not be found.';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -382,12 +340,12 @@ class MissingDatasourceConfigException extends CakeException {
|
|||
}
|
||||
|
||||
/**
|
||||
* Exception class to be thrown when a datasource is not found
|
||||
* Used when a datasource cannot be found.
|
||||
*
|
||||
* @package Cake.Error
|
||||
*/
|
||||
class MissingDatasourceFileException extends CakeException {
|
||||
protected $_messageTemplate = 'Datasource "%s" was not found.';
|
||||
class MissingDatasourceException extends CakeException {
|
||||
protected $_messageTemplate = 'Datasource class %s could not be found.';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -354,7 +354,7 @@ class I18n {
|
|||
/**
|
||||
* Loads the binary .mo file for translation and sets the values for this translation in the var I18n::_domains
|
||||
*
|
||||
* @param resource $file Binary .mo file to load
|
||||
* @param string $file Binary .mo file to load
|
||||
* @param string $domain Domain where to load file in
|
||||
* @return void
|
||||
*/
|
||||
|
|
|
@ -41,7 +41,7 @@ class AclNode extends AppModel {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public $actsAs = array('Tree' => array('nested'));
|
||||
public $actsAs = array('Tree' => array('type' => 'nested'));
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -85,7 +85,7 @@ class AclNode extends AppModel {
|
|||
$db->name("{$type}.rght") . ' >= ' . $db->name("{$type}0.rght")),
|
||||
'fields' => array('id', 'parent_id', 'model', 'foreign_key', 'alias'),
|
||||
'joins' => array(array(
|
||||
'table' => $db->fullTableName($this),
|
||||
'table' => $table,
|
||||
'alias' => "{$type}0",
|
||||
'type' => 'LEFT',
|
||||
'conditions' => array("{$type}0.alias" => $start)
|
||||
|
@ -97,7 +97,7 @@ class AclNode extends AppModel {
|
|||
$j = $i - 1;
|
||||
|
||||
$queryData['joins'][] = array(
|
||||
'table' => $db->fullTableName($this),
|
||||
'table' => $table,
|
||||
'alias' => "{$type}{$i}",
|
||||
'type' => 'LEFT',
|
||||
'conditions' => array(
|
||||
|
@ -163,7 +163,7 @@ class AclNode extends AppModel {
|
|||
'conditions' => $ref,
|
||||
'fields' => array('id', 'parent_id', 'model', 'foreign_key', 'alias'),
|
||||
'joins' => array(array(
|
||||
'table' => $db->fullTableName($this),
|
||||
'table' => $table,
|
||||
'alias' => "{$type}0",
|
||||
'type' => 'LEFT',
|
||||
'conditions' => array(
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package Cake.Model
|
||||
* @subpackage cake.cake.libs.model
|
||||
* @since CakePHP(tm) v 0.2.9
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
@ -26,7 +25,6 @@ App::uses('AppModel', 'Model');
|
|||
* Access Control Object
|
||||
*
|
||||
* @package Cake.Model
|
||||
* @subpackage cake.cake.libs.model
|
||||
*/
|
||||
class Aco extends AclNode {
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package Cake.Model
|
||||
* @subpackage cake.cake.libs.model
|
||||
* @since CakePHP(tm) v 0.2.9
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
@ -26,7 +25,6 @@ App::uses('AppModel', 'Model');
|
|||
* Action for Access Control Object
|
||||
*
|
||||
* @package Cake.Model
|
||||
* @subpackage cake.cake.libs.model
|
||||
*/
|
||||
class AcoAction extends AppModel {
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package Cake.Model
|
||||
* @subpackage cake.cake.libs.model
|
||||
* @since CakePHP(tm) v 0.2.9
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
@ -27,11 +26,10 @@ App::uses('Model', 'Model');
|
|||
* Application model for Cake.
|
||||
*
|
||||
* This is a placeholder class.
|
||||
* Create the same file in app/app_model.php
|
||||
* Create the same file in app/Model/AppModel.php
|
||||
* Add your application-wide methods to the class, your models will inherit them.
|
||||
*
|
||||
* @package Cake.Model
|
||||
* @subpackage cake.cake.libs.model
|
||||
*/
|
||||
class AppModel extends Model {
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ App::uses('AclNode', 'Model');
|
|||
* ACL behavior
|
||||
*
|
||||
* @package Cake.Model.Behavior
|
||||
* @link http://book.cakephp.org/view/1320/ACL
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/behaviors/acl.html
|
||||
*/
|
||||
class AclBehavior extends ModelBehavior {
|
||||
|
||||
|
@ -36,17 +36,18 @@ class AclBehavior extends ModelBehavior {
|
|||
protected $_typeMaps = array('requester' => 'Aro', 'controlled' => 'Aco', 'both' => array('Aro', 'Aco'));
|
||||
|
||||
/**
|
||||
* Sets up the configuation for the model, and loads ACL models if they haven't been already
|
||||
* Sets up the configuration for the model, and loads ACL models if they haven't been already
|
||||
*
|
||||
* @param Model $model
|
||||
* @param array $config
|
||||
* @return void
|
||||
*/
|
||||
public function setup($model, $config = array()) {
|
||||
if (is_string($config)) {
|
||||
$config = array('type' => $config);
|
||||
if (isset($config[0])) {
|
||||
$config['type'] = $config[0];
|
||||
unset($config[0]);
|
||||
}
|
||||
$this->settings[$model->name] = array_merge(array('type' => 'controlled'), (array)$config);
|
||||
$this->settings[$model->name] = array_merge(array('type' => 'controlled'), $config);
|
||||
$this->settings[$model->name]['type'] = strtolower($this->settings[$model->name]['type']);
|
||||
|
||||
$types = $this->_typeMaps[$this->settings[$model->name]['type']];
|
||||
|
@ -69,7 +70,7 @@ class AclBehavior extends ModelBehavior {
|
|||
* @param mixed $ref
|
||||
* @param string $type Only needed when Acl is set up as 'both', specify 'Aro' or 'Aco' to get the correct node
|
||||
* @return array
|
||||
* @link http://book.cakephp.org/view/1322/node
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/behaviors/acl.html#node
|
||||
*/
|
||||
public function node($model, $ref = null, $type = null) {
|
||||
if (empty($type)) {
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* the amount of associations and data returned.
|
||||
*
|
||||
* @package Cake.Model.Behavior
|
||||
* @link http://book.cakephp.org/view/1323/Containable
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/behaviors/containable.html
|
||||
*/
|
||||
class ContainableBehavior extends ModelBehavior {
|
||||
|
||||
|
@ -64,9 +64,6 @@ class ContainableBehavior extends ModelBehavior {
|
|||
if (!isset($this->settings[$Model->alias])) {
|
||||
$this->settings[$Model->alias] = array('recursive' => true, 'notices' => true, 'autoFields' => true);
|
||||
}
|
||||
if (!is_array($settings)) {
|
||||
$settings = array();
|
||||
}
|
||||
$this->settings[$Model->alias] = array_merge($this->settings[$Model->alias], $settings);
|
||||
}
|
||||
|
||||
|
@ -148,8 +145,6 @@ class ContainableBehavior extends ModelBehavior {
|
|||
if (!empty($unbind)) {
|
||||
if (!$reset && empty($instance->__backOriginalAssociation)) {
|
||||
$instance->__backOriginalAssociation = $backupBindings;
|
||||
} else if ($reset && empty($instance->__backContainableAssociation)) {
|
||||
$instance->__backContainableAssociation = $backupBindings;
|
||||
}
|
||||
$instance->unbindModel(array($type => $unbind), $reset);
|
||||
}
|
||||
|
@ -221,31 +216,13 @@ class ContainableBehavior extends ModelBehavior {
|
|||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets original associations on models that may have receive multiple,
|
||||
* subsequent unbindings.
|
||||
*
|
||||
* @param Model $Model Model on which we are resetting
|
||||
* @param array $results Results of the find operation
|
||||
* @param boolean $primary true if this is the primary model that issued the find operation, false otherwise
|
||||
* @return void
|
||||
*/
|
||||
public function afterFind($Model, $results, $primary) {
|
||||
if (!empty($Model->__backContainableAssociation)) {
|
||||
foreach ($Model->__backContainableAssociation as $relation => $bindings) {
|
||||
$Model->{$relation} = $bindings;
|
||||
unset($Model->__backContainableAssociation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unbinds all relations from a model except the specified ones. Calling this function without
|
||||
* parameters unbinds all related models.
|
||||
*
|
||||
* @param Model $Model Model on which binding restriction is being applied
|
||||
* @return void
|
||||
* @link http://book.cakephp.org/view/1323/Containable#Using-Containable-1324
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/behaviors/containable.html#using-containable
|
||||
*/
|
||||
public function contain($Model) {
|
||||
$args = func_get_args();
|
||||
|
|
|
@ -23,7 +23,7 @@ App::uses('I18n', 'I18n');
|
|||
* Translate behavior
|
||||
*
|
||||
* @package Cake.Model.Behavior
|
||||
* @link http://book.cakephp.org/view/1328/Translate
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/behaviors/translate.html
|
||||
*/
|
||||
class TranslateBehavior extends ModelBehavior {
|
||||
|
||||
|
@ -99,17 +99,16 @@ class TranslateBehavior extends ModelBehavior {
|
|||
} else {
|
||||
$tablePrefix = $db->config['prefix'];
|
||||
}
|
||||
|
||||
if ($tablePrefix == $db->config['prefix']) {
|
||||
$tablePrefix = null;
|
||||
}
|
||||
$joinTable = new StdClass();
|
||||
$joinTable->tablePrefix = $tablePrefix;
|
||||
$joinTable->table = $RuntimeModel->table;
|
||||
|
||||
if (is_string($query['fields']) && 'COUNT(*) AS '.$db->name('count') == $query['fields']) {
|
||||
$query['fields'] = 'COUNT(DISTINCT('.$db->name($model->alias . '.' . $model->primaryKey) . ')) ' . $db->alias . 'count';
|
||||
$query['joins'][] = array(
|
||||
'type' => 'INNER',
|
||||
'alias' => $RuntimeModel->alias,
|
||||
'table' => $db->fullTableName($tablePrefix . $RuntimeModel->useTable),
|
||||
'table' => $joinTable,
|
||||
'conditions' => array(
|
||||
$model->alias . '.' . $model->primaryKey => $db->identifier($RuntimeModel->alias.'.foreign_key'),
|
||||
$RuntimeModel->alias.'.model' => $model->name,
|
||||
|
@ -155,7 +154,7 @@ class TranslateBehavior extends ModelBehavior {
|
|||
$query['joins'][] = array(
|
||||
'type' => 'LEFT',
|
||||
'alias' => 'I18n__'.$field.'__'.$_locale,
|
||||
'table' => $db->fullTableName($tablePrefix . $RuntimeModel->useTable),
|
||||
'table' => $joinTable,
|
||||
'conditions' => array(
|
||||
$model->alias . '.' . $model->primaryKey => $db->identifier("I18n__{$field}__{$_locale}.foreign_key"),
|
||||
'I18n__'.$field.'__'.$_locale.'.model' => $model->name,
|
||||
|
@ -170,21 +169,16 @@ class TranslateBehavior extends ModelBehavior {
|
|||
$query['fields'][] = 'i18n_'.$field;
|
||||
}
|
||||
$query['joins'][] = array(
|
||||
'type' => 'LEFT',
|
||||
'type' => 'INNER',
|
||||
'alias' => 'I18n__'.$field,
|
||||
'table' => $db->fullTableName($tablePrefix . $RuntimeModel->useTable),
|
||||
'table' => $joinTable,
|
||||
'conditions' => array(
|
||||
$model->alias . '.' . $model->primaryKey => $db->identifier("I18n__{$field}.foreign_key"),
|
||||
'I18n__'.$field.'.model' => $model->name,
|
||||
'I18n__'.$field.'.'.$RuntimeModel->displayField => $aliasField
|
||||
'I18n__'.$field.'.'.$RuntimeModel->displayField => $aliasField,
|
||||
'I18n__'.$field.'.locale' => $locale
|
||||
)
|
||||
);
|
||||
|
||||
if (is_string($query['conditions'])) {
|
||||
$query['conditions'] = $db->conditions($query['conditions'], true, false, $model) . ' AND '.$db->name('I18n__'.$field.'.locale').' = \''.$locale.'\'';
|
||||
} else {
|
||||
$query['conditions'][$db->name("I18n__{$field}.locale")] = $locale;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue