リビジョン 635eef61
| .editorconfig | ||
|---|---|---|
| 1 | ; This file is for unifying the coding style for different editors and IDEs. | |
| 2 | ; More information at http://editorconfig.org | |
| 3 |  | |
| 4 | root = true | |
| 5 |  | |
| 6 | [*] | |
| 7 | indent_style = tab | |
| 8 | end_of_line = lf | |
| 9 | insert_final_newline = true | |
| 10 | trim_trailing_whitespace = true | |
| 11 |  | |
| 12 | [*.bat] | |
| 13 | end_of_line = crlf | |
| 14 |  | |
| 15 | [*.yml] | |
| 16 | indent_style = space | |
| 17 | indent_size = 2 | |
| .gitattributes | ||
|---|---|---|
| 1 | # Define the line ending behavior of the different file extensions | |
| 2 | # Set default behaviour, in case users don't have core.autocrlf set. | |
| 3 | * text=auto | |
| 4 | * text eol=lf | |
| 5 |  | |
| 6 | # Explicitly declare text files we want to always be normalized and converted | |
| 7 | # to native line endings on checkout. | |
| 8 | *.php text | |
| 9 | *.default text | |
| 10 | *.ctp text | |
| 11 | *.sql text | |
| 12 | *.md text | |
| 13 | *.po text | |
| 14 | *.js text | |
| 15 | *.css text | |
| 16 | *.ini text | |
| 17 | *.properties text | |
| 18 | *.txt text | |
| 19 | *.xml text | |
| 20 | *.yml text | |
| 21 | .htaccess text | |
| 22 |  | |
| 23 | # Declare files that will always have CRLF line endings on checkout. | |
| 24 | *.bat eol=crlf | |
| 25 |  | |
| 26 | # Declare files that will always have LF line endings on checkout. | |
| 27 | *.pem eol=lf | |
| 28 |  | |
| 29 | # Denote all files that are truly binary and should not be modified. | |
| 30 | *.png binary | |
| 31 | *.jpg binary | |
| 32 | *.gif binary | |
| 33 | *.ico binary | |
| 34 | *.mo binary | |
| 35 | *.pdf binary | |
| 36 | *.woff binary | |
| 37 | *.ttf binary | |
| 38 | *.eot binary | |
| .gitignore | ||
|---|---|---|
| 1 | # User specific & automatically generated files # | |
| 2 | ################################################# | |
| 3 | /app/Config/database.php | |
| 4 | /app/tmp | |
| 5 | /lib/Cake/Console/Templates/skel/tmp/ | |
| 6 | /plugins | |
| 7 | /vendors | |
| 8 | /build | |
| 9 | /dist | |
| 10 | /tags | |
| 11 | *.mo | |
| 12 |  | |
| 13 | # IDE and editor specific files # | |
| 14 | ################################# | |
| 15 | /nbproject | |
| 16 | .idea | |
| 17 |  | |
| 18 | # OS generated files # | |
| 19 | ###################### | |
| 20 | .DS_Store | |
| 21 | .DS_Store? | |
| 22 | ._* | |
| 23 | .Spotlight-V100 | |
| 24 | .Trashes | |
| 25 | Icon? | |
| 26 | ehthumbs.db | |
| 27 | Thumbs.db | |
| .htaccess | ||
|---|---|---|
| 1 | <IfModule mod_rewrite.c> | |
| 2 | RewriteEngine on | |
| 3 | RewriteRule ^$ app/webroot/ [L] | |
| 4 | RewriteRule (.*) app/webroot/$1 [L] | |
| 5 | </IfModule> | |
| .travis.yml | ||
|---|---|---|
| 1 | language: php | |
| 2 |  | |
| 3 | php: | |
| 4 | - 5.3 | |
| 5 | - 5.4 | |
| 6 | - 5.5 | |
| 7 | - 5.6 | |
| 8 |  | |
| 9 | env: | |
| 10 | - DB=mysql | |
| 11 |  | |
| 12 | services: | |
| 13 | - memcached | |
| 14 |  | |
| 15 | matrix: | |
| 16 | fast_finish: true | |
| 17 | include: | |
| 18 | - php: 5.4 | |
| 19 | env: DB=pgsql | |
| 20 |  | |
| 21 | - php: 5.4 | |
| 22 | env: DB=sqlite | |
| 23 |  | |
| 24 | - php: 5.4 | |
| 25 | env: PHPCS=1 | |
| 26 |  | |
| 27 |  | |
| 28 | before_script: | |
| 29 | - sh -c "composer global require 'phpunit/phpunit=3.7.33'" | |
| 30 | - sh -c "ln -s ~/.composer/vendor/phpunit/phpunit/PHPUnit ./vendors/PHPUnit" | |
| 31 | - sudo locale-gen de_DE | |
| 32 | - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test;'; fi" | |
| 33 | - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test2;'; fi" | |
| 34 | - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test3;'; fi" | |
| 35 | - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE DATABASE cakephp_test;' -U postgres; fi" | |
| 36 | - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE SCHEMA test2;' -U postgres -d cakephp_test; fi" | |
| 37 | - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE SCHEMA test3;' -U postgres -d cakephp_test; fi" | |
| 38 | - chmod -R 777 ./app/tmp | |
| 39 | - sh -c "if [ '$PHPCS' = '1' ]; then composer global require 'cakephp/cakephp-codesniffer:1.*'; fi" | |
| 40 | - sh -c "if [ '$PHPCS' = '1' ]; then ~/.composer/vendor/bin/phpcs --config-set installed_paths ~/.composer/vendor/cakephp/cakephp-codesniffer; fi" | |
| 41 | - echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini | |
| 42 | - phpenv rehash | |
| 43 | - set +H | |
| 44 | - echo "<?php | |
| 45 |     class DATABASE_CONFIG {
 | |
| 46 | private \$identities = array( | |
| 47 | 'mysql' => array( | |
| 48 | 'datasource' => 'Database/Mysql', | |
| 49 | 'host' => '0.0.0.0', | |
| 50 | 'login' => 'travis' | |
| 51 | ), | |
| 52 | 'pgsql' => array( | |
| 53 | 'datasource' => 'Database/Postgres', | |
| 54 | 'host' => '127.0.0.1', | |
| 55 | 'login' => 'postgres', | |
| 56 | 'database' => 'cakephp_test', | |
| 57 | 'schema' => array( | |
| 58 | 'default' => 'public', | |
| 59 | 'test' => 'public', | |
| 60 | 'test2' => 'test2', | |
| 61 | 'test_database_three' => 'test3' | |
| 62 | ) | |
| 63 | ), | |
| 64 | 'sqlite' => array( | |
| 65 | 'datasource' => 'Database/Sqlite', | |
| 66 | 'database' => array( | |
| 67 | 'default' => ':memory:', | |
| 68 | 'test' => ':memory:', | |
| 69 | 'test2' => '/tmp/cakephp_test2.db', | |
| 70 | 'test_database_three' => '/tmp/cakephp_test3.db' | |
| 71 | ), | |
| 72 | ) | |
| 73 | ); | |
| 74 | public \$default = array( | |
| 75 | 'persistent' => false, | |
| 76 | 'host' => '', | |
| 77 | 'login' => '', | |
| 78 | 'password' => '', | |
| 79 | 'database' => 'cakephp_test', | |
| 80 | 'prefix' => '' | |
| 81 | ); | |
| 82 | public \$test = array( | |
| 83 | 'persistent' => false, | |
| 84 | 'host' => '', | |
| 85 | 'login' => '', | |
| 86 | 'password' => '', | |
| 87 | 'database' => 'cakephp_test', | |
| 88 | 'prefix' => '' | |
| 89 | ); | |
| 90 | public \$test2 = array( | |
| 91 | 'persistent' => false, | |
| 92 | 'host' => '', | |
| 93 | 'login' => '', | |
| 94 | 'password' => '', | |
| 95 | 'database' => 'cakephp_test2', | |
| 96 | 'prefix' => '' | |
| 97 | ); | |
| 98 | public \$test_database_three = array( | |
| 99 | 'persistent' => false, | |
| 100 | 'host' => '', | |
| 101 | 'login' => '', | |
| 102 | 'password' => '', | |
| 103 | 'database' => 'cakephp_test3', | |
| 104 | 'prefix' => '' | |
| 105 | ); | |
| 106 |     public function __construct() {
 | |
| 107 | \$db = 'mysql'; | |
| 108 |       if (!empty(\$_SERVER['DB'])) {
 | |
| 109 | \$db = \$_SERVER['DB']; | |
| 110 | } | |
| 111 |       foreach (array('default', 'test', 'test2', 'test_database_three') as \$source) {
 | |
| 112 |         \$config = array_merge(\$this->{\$source}, \$this->identities[\$db]);
 | |
| 113 |         if (is_array(\$config['database'])) {
 | |
| 114 | \$config['database'] = \$config['database'][\$source]; | |
| 115 | } | |
| 116 |         if (!empty(\$config['schema']) && is_array(\$config['schema'])) {
 | |
| 117 | \$config['schema'] = \$config['schema'][\$source]; | |
| 118 | } | |
| 119 |         \$this->{\$source} = \$config;
 | |
| 120 | } | |
| 121 | } | |
| 122 | }" > app/Config/database.php | |
| 123 | script: | |
| 124 | - sh -c "if [ '$PHPCS' != '1' ]; then ./lib/Cake/Console/cake test core AllTests --stderr; fi" | |
| 125 | - sh -c "if [ '$PHPCS' = '1' ]; then ~/.composer/vendor/bin/phpcs -p --extensions=php --standard=CakePHP ./lib/Cake; fi;" | |
| 126 |  | |
| 127 | notifications: | |
| 128 | email: false | |
| CONTRIBUTING.md | ||
|---|---|---|
| 1 | # How to contribute | |
| 2 |  | |
| 3 | CakePHP loves to welcome your contributions. There are several ways to help out: | |
| 4 | * Create an [issue](https://github.com/cakephp/cakephp/issues) on GitHub, if you have found a bug | |
| 5 | * Write test cases for open bug issues | |
| 6 | * Write patches for open bug/feature issues, preferably with test cases included | |
| 7 | * Contribute to the [documentation](https://github.com/cakephp/docs) | |
| 8 |  | |
| 9 | There are a few guidelines that we need contributors to follow so that we have a | |
| 10 | chance of keeping on top of things. | |
| 11 |  | |
| 12 | ## Code of Conduct | |
| 13 |  | |
| 14 | Help us keep CakePHP open and inclusive. Please read and follow our [Code of Conduct](https://github.com/cakephp/code-of-conduct/blob/master/CODE_OF_CONDUCT.md). | |
| 15 |  | |
| 16 | ## Getting Started | |
| 17 |  | |
| 18 | * Make sure you have a [GitHub account](https://github.com/signup/free). | |
| 19 | * Submit an [issue](https://github.com/cakephp/cakephp/issues), assuming one does not already exist. | |
| 20 | * Clearly describe the issue including steps to reproduce when it is a bug. | |
| 21 | * Make sure you fill in the earliest version that you know has the issue. | |
| 22 | * Fork the repository on GitHub. | |
| 23 |  | |
| 24 | ## Making Changes | |
| 25 |  | |
| 26 | * Create a topic branch from where you want to base your work. | |
| 27 | * This is usually the master branch. | |
| 28 | * Only target release branches if you are certain your fix must be on that | |
| 29 | branch. | |
| 30 | * To quickly create a topic branch based on master; `git branch | |
| 31 | master/my_contribution master` then checkout the new branch with `git | |
| 32 | checkout master/my_contribution`. Better avoid working directly on the | |
| 33 | `master` branch, to avoid conflicts if you pull in updates from origin. | |
| 34 | * Make commits of logical units. | |
| 35 | * Check for unnecessary whitespace with `git diff --check` before committing. | |
| 36 | * Use descriptive commit messages and reference the #issue number. | |
| 37 | * Core test cases should continue to pass. You can run tests locally or enable | |
| 38 | [travis-ci](https://travis-ci.org/) for your fork, so all tests and codesniffs | |
| 39 | will be executed. | |
| 40 | * Your work should apply the [CakePHP coding standards](http://book.cakephp.org/2.0/en/contributing/cakephp-coding-conventions.html). | |
| 41 |  | |
| 42 | ## Which branch to base the work | |
| 43 |  | |
| 44 | * Bugfix branches will be based on master. | |
| 45 | * New features that are backwards compatible will be based on next minor release | |
| 46 | branch. | |
| 47 | * New features or other non backwards compatible changes will go in the next major release branch. | |
| 48 |  | |
| 49 | ## Submitting Changes | |
| 50 |  | |
| 51 | * Push your changes to a topic branch in your fork of the repository. | |
| 52 | * Submit a pull request to the repository in the cakephp organization, with the | |
| 53 | correct target branch. | |
| 54 |  | |
| 55 | ## Test cases and codesniffer | |
| 56 |  | |
| 57 | CakePHP tests requires [PHPUnit](http://www.phpunit.de/manual/current/en/installation.html) | |
| 58 | 3.7, version 4 is not compatible. To run the test cases locally use the following command: | |
| 59 |  | |
| 60 | ./lib/Cake/Console/cake test core AllTests --stderr | |
| 61 |  | |
| 62 | To run the sniffs for CakePHP coding standards: | |
| 63 |  | |
| 64 | phpcs -p --extensions=php --standard=CakePHP ./lib/Cake | |
| 65 |  | |
| 66 | Check the [cakephp-codesniffer](https://github.com/cakephp/cakephp-codesniffer) | |
| 67 | repository to setup the CakePHP standard. The [README](https://github.com/cakephp/cakephp-codesniffer/blob/master/README.md) contains installation info | |
| 68 | for the sniff and phpcs. | |
| 69 |  | |
| 70 | ## Reporting a Security Issue | |
| 71 |  | |
| 72 | If you've found a security related issue in CakePHP, please don't open an issue in GitHub. Instead contact us at security@cakephp.org. For more information on how we handle security issues, [see the CakePHP Security Issue Process](http://book.cakephp.org/2.0/en/contributing/tickets.html#reporting-security-issues). | |
| 73 |  | |
| 74 | # Additional Resources | |
| 75 |  | |
| 76 | * [CakePHP coding standards](http://book.cakephp.org/2.0/en/contributing/cakephp-coding-conventions.html) | |
| 77 | * [Existing issues](https://github.com/cakephp/cakephp/issues) | |
| 78 | * [Development Roadmaps](https://github.com/cakephp/cakephp/wiki#roadmaps) | |
| 79 | * [General GitHub documentation](https://help.github.com/) | |
| 80 | * [GitHub pull request documentation](https://help.github.com/send-pull-requests/) | |
| 81 | * #cakephp IRC channel on freenode.org | |
| README.md | ||
|---|---|---|
| 1 | # CakePHP | |
| 2 |  | |
| 3 | [](https://packagist.org/packages/cakephp/cakephp) | |
| 4 | [](https://packagist.org/packages/cakephp/cakephp) | |
| 5 | [](http://travis-ci.org/cakephp/cakephp) | |
| 6 | [](http://squizlabs.github.io/PHP_CodeSniffer/analysis/cakephp/cakephp/) | |
| 7 |  | |
| 8 | [](http://www.cakephp.org) | |
| 9 |  | |
| 10 | CakePHP is a rapid development framework for PHP which uses commonly known design patterns like Active Record, Association Data Mapping, Front Controller and MVC. | |
| 11 | Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility. | |
| 12 |  | |
| 13 |  | |
| 14 | ## Some Handy Links | |
| 15 |  | |
| 16 | [CakePHP](http://www.cakephp.org) - The rapid development PHP framework | |
| 17 |  | |
| 18 | [CookBook](http://book.cakephp.org) - THE CakePHP user documentation; start learning here! | |
| 19 |  | |
| 20 | [API](http://api.cakephp.org) - A reference to CakePHP's classes | |
| 21 |  | |
| 22 | [Plugins](http://plugins.cakephp.org/) - A repository of extensions to the framework | |
| 23 |  | |
| 24 | [The Bakery](http://bakery.cakephp.org) - Tips, tutorials and articles | |
| 25 |  | |
| 26 | [Community Center](http://community.cakephp.org) - A source for everything community related | |
| 27 |  | |
| 28 | [Training](http://training.cakephp.org) - Join a live session and get skilled with the framework | |
| 29 |  | |
| 30 | [CakeFest](http://cakefest.org) - Don't miss our annual CakePHP conference | |
| 31 |  | |
| 32 | [Cake Software Foundation](http://cakefoundation.org) - Promoting development related to CakePHP | |
| 33 |  | |
| 34 |  | |
| 35 | ## Get Support! | |
| 36 |  | |
| 37 | [#cakephp](http://webchat.freenode.net/?channels=#cakephp) on irc.freenode.net - Come chat with us, we have cake | |
| 38 |  | |
| 39 | [Google Group](https://groups.google.com/group/cake-php) - Community mailing list and forum | |
| 40 |  | |
| 41 | [GitHub Issues](https://github.com/cakephp/cakephp/issues) - Got issues? Please tell us! | |
| 42 |  | |
| 43 | [Roadmaps](https://github.com/cakephp/cakephp/wiki#roadmaps) - Want to contribute? Get involved! | |
| 44 |  | |
| 45 |  | |
| 46 | ## Contributing | |
| 47 |  | |
| 48 | [CONTRIBUTING.md](CONTRIBUTING.md) - Quick pointers for contributing to the CakePHP project | |
| 49 |  | |
| 50 | [CookBook "Contributing" Section (2.x)](http://book.cakephp.org/2.0/en/contributing.html) [(3.0)](http://book.cakephp.org/3.0/en/contributing.html) - Version-specific details about contributing to the project | |
| app/.htaccess | ||
|---|---|---|
| 1 | <IfModule mod_rewrite.c> | |
| 2 | RewriteEngine on | |
| 3 | RewriteRule ^$ webroot/ [L] | |
| 4 | RewriteRule (.*) webroot/$1 [L] | |
| 5 | </IfModule> | |
| app/Config/Schema/db_acl.php | ||
|---|---|---|
| 1 | <?php | |
| 2 | /** | |
| 3 | * This is Acl Schema file | |
| 4 | * | |
| 5 | * Use it to configure database for ACL | |
| 6 | * | |
| 7 | * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) | |
| 8 | * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) | |
| 9 | * | |
| 10 | * Licensed under The MIT License | |
| 11 | * For full copyright and license information, please see the LICENSE.txt | |
| 12 | * Redistributions of files must retain the above copyright notice. | |
| 13 | * | |
| 14 | * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) | |
| 15 | * @link http://cakephp.org CakePHP(tm) Project | |
| 16 | * @package app.Config.Schema | |
| 17 | * @since CakePHP(tm) v 0.2.9 | |
| 18 | * @license http://www.opensource.org/licenses/mit-license.php MIT License | |
| 19 | */ | |
| 20 |  | |
| 21 | /** | |
| 22 | * Using the Schema command line utility | |
| 23 | * cake schema run create DbAcl | |
| 24 | */ | |
| 25 | class DbAclSchema extends CakeSchema {
 | |
| 26 |  | |
| 27 | /** | |
| 28 | * Before event. | |
| 29 | * | |
| 30 | * @param array $event The event data. | |
| 31 | * @return bool Success | |
| 32 | */ | |
| 33 | 	public function before($event = array()) {
 | |
| 34 | return true; | |
| 35 | } | |
| 36 |  | |
| 37 | /** | |
| 38 | * After event. | |
| 39 | * | |
| 40 | * @param array $event The event data. | |
| 41 | * @return void | |
| 42 | */ | |
| 43 | 	public function after($event = array()) {
 | |
| 44 | } | |
| 45 |  | |
| 46 | /** | |
| 47 | * ACO - Access Control Object - Something that is wanted | |
| 48 | */ | |
| 49 | public $acos = array( | |
| 50 | 		'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
 | |
| 51 | 		'parent_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
 | |
| 52 | 		'model' => array('type' => 'string', 'null' => true),
 | |
| 53 | 		'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
 | |
| 54 | 		'alias' => array('type' => 'string', 'null' => true),
 | |
| 55 | 		'lft' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
 | |
| 56 | 		'rght' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
 | |
| 57 | 'indexes' => array( | |
| 58 | 			'PRIMARY' => array('column' => 'id', 'unique' => 1),
 | |
| 59 | 			'idx_acos_lft_rght' => array('column' => array('lft', 'rght'), 'unique' => 0),
 | |
| 60 | 			'idx_acos_alias' => array('column' => 'alias', 'unique' => 0)
 | |
| 61 | ) | |
| 62 | ); | |
| 63 |  | |
| 64 | /** | |
| 65 | * ARO - Access Request Object - Something that wants something | |
| 66 | */ | |
| 67 | public $aros = array( | |
| 68 | 		'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
 | |
| 69 | 		'parent_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
 | |
| 70 | 		'model' => array('type' => 'string', 'null' => true),
 | |
| 71 | 		'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
 | |
| 72 | 		'alias' => array('type' => 'string', 'null' => true),
 | |
| 73 | 		'lft' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
 | |
| 74 | 		'rght' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
 | |
| 75 | 'indexes' => array( | |
| 76 | 			'PRIMARY' => array('column' => 'id', 'unique' => 1),
 | |
| 77 | 			'idx_aros_lft_rght' => array('column' => array('lft', 'rght'), 'unique' => 0),
 | |
| 78 | 			'idx_aros_alias' => array('column' => 'alias', 'unique' => 0)
 | |
| 79 | ) | |
| 80 | ); | |
| 81 |  | |
| 82 | /** | |
| 83 | * Used by the Cake::Model:Permission class. | |
| 84 | * Checks if the given $aro has access to action $action in $aco. | |
| 85 | */ | |
| 86 | public $aros_acos = array( | |
| 87 | 		'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
 | |
| 88 | 		'aro_id' => array('type' => 'integer', 'null' => false, 'length' => 10, 'key' => 'index'),
 | |
| 89 | 		'aco_id' => array('type' => 'integer', 'null' => false, 'length' => 10),
 | |
| 90 | 		'_create' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2),
 | |
| 91 | 		'_read' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2),
 | |
| 92 | 		'_update' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2),
 | |
| 93 | 		'_delete' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2),
 | |
| 94 | 'indexes' => array( | |
| 95 | 			'PRIMARY' => array('column' => 'id', 'unique' => 1),
 | |
| 96 | 			'ARO_ACO_KEY' => array('column' => array('aro_id', 'aco_id'), 'unique' => 1),
 | |
| 97 | 			'idx_aco_id' => array('column' => 'aco_id', 'unique' => 0)
 | |
| 98 | ) | |
| 99 | ); | |
| 100 |  | |
| 101 | } | |
| app/Config/Schema/db_acl.sql | ||
|---|---|---|
| 1 | # $Id$ | |
| 2 | # | |
| 3 | # Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) | |
| 4 | # | |
| 5 | # Licensed under The MIT License | |
| 6 | # For full copyright and license information, please see the LICENSE.txt | |
| 7 | # Redistributions of files must retain the above copyright notice. | |
| 8 | # MIT License (http://www.opensource.org/licenses/mit-license.php) | |
| 9 |  | |
| 10 | CREATE TABLE acos ( | |
| 11 | id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, | |
| 12 | parent_id INTEGER(10) DEFAULT NULL, | |
| 13 | model VARCHAR(255) DEFAULT '', | |
| 14 | foreign_key INTEGER(10) UNSIGNED DEFAULT NULL, | |
| 15 | alias VARCHAR(255) DEFAULT '', | |
| 16 | lft INTEGER(10) DEFAULT NULL, | |
| 17 | rght INTEGER(10) DEFAULT NULL, | |
| 18 | PRIMARY KEY (id) | |
| 19 | ); | |
| 20 |  | |
| 21 | CREATE TABLE aros_acos ( | |
| 22 | id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, | |
| 23 | aro_id INTEGER(10) UNSIGNED NOT NULL, | |
| 24 | aco_id INTEGER(10) UNSIGNED NOT NULL, | |
| 25 | _create CHAR(2) NOT NULL DEFAULT 0, | |
| 26 | _read CHAR(2) NOT NULL DEFAULT 0, | |
| 27 | _update CHAR(2) NOT NULL DEFAULT 0, | |
| 28 | _delete CHAR(2) NOT NULL DEFAULT 0, | |
| 29 | PRIMARY KEY(id) | |
| 30 | ); | |
| 31 |  | |
| 32 | CREATE TABLE aros ( | |
| 33 | id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, | |
| 34 | parent_id INTEGER(10) DEFAULT NULL, | |
| 35 | model VARCHAR(255) DEFAULT '', | |
| 36 | foreign_key INTEGER(10) UNSIGNED DEFAULT NULL, | |
| 37 | alias VARCHAR(255) DEFAULT '', | |
| 38 | lft INTEGER(10) DEFAULT NULL, | |
| 39 | rght INTEGER(10) DEFAULT NULL, | |
| 40 | PRIMARY KEY (id) | |
| 41 | ); | |
| 42 |  | |
| 43 | /* this indexes will improve acl perfomance */ | |
| 44 | CREATE INDEX idx_acos_lft_rght ON `acos` (`lft`, `rght`); | |
| 45 |  | |
| 46 | CREATE INDEX idx_acos_alias ON `acos` (`alias`); | |
| 47 |  | |
| 48 | CREATE INDEX idx_aros_lft_rght ON `aros` (`lft`, `rght`); | |
| 49 |  | |
| 50 | CREATE INDEX idx_aros_alias ON `aros` (`alias`); | |
| 51 |  | |
| 52 | CREATE INDEX idx_aco_id ON `aros_acos` (`aco_id`); | |
| app/Config/Schema/i18n.php | ||
|---|---|---|
| 1 | <?php | |
| 2 | /** | |
| 3 | * This is i18n Schema file | |
| 4 | * | |
| 5 | * Use it to configure database for i18n | |
| 6 | * | |
| 7 | * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) | |
| 8 | * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) | |
| 9 | * | |
| 10 | * Licensed under The MIT License | |
| 11 | * For full copyright and license information, please see the LICENSE.txt | |
| 12 | * Redistributions of files must retain the above copyright notice. | |
| 13 | * | |
| 14 | * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) | |
| 15 | * @link http://cakephp.org CakePHP(tm) Project | |
| 16 | * @package app.Config.Schema | |
| 17 | * @since CakePHP(tm) v 0.2.9 | |
| 18 | * @license http://www.opensource.org/licenses/mit-license.php MIT License | |
| 19 | */ | |
| 20 |  | |
| 21 | /** | |
| 22 | * Using the Schema command line utility | |
| 23 | * | |
| 24 | * Use it to configure database for i18n | |
| 25 | * | |
| 26 | * cake schema run create i18n | |
| 27 | */ | |
| 28 | class I18nSchema extends CakeSchema {
 | |
| 29 |  | |
| 30 | /** | |
| 31 | * The name property | |
| 32 | * | |
| 33 | * @var string | |
| 34 | */ | |
| 35 | public $name = 'i18n'; | |
| 36 |  | |
| 37 | /** | |
| 38 | * Before callback. | |
| 39 | * | |
| 40 | * @param array $event Schema object properties | |
| 41 | * @return bool Should process continue | |
| 42 | */ | |
| 43 | 	public function before($event = array()) {
 | |
| 44 | return true; | |
| 45 | } | |
| 46 |  | |
| 47 | /** | |
| 48 | * After callback. | |
| 49 | * | |
| 50 | * @param array $event Schema object properties | |
| 51 | * @return void | |
| 52 | */ | |
| 53 | 	public function after($event = array()) {
 | |
| 54 | } | |
| 55 |  | |
| 56 | /** | |
| 57 | * The i18n table definition | |
| 58 | * | |
| 59 | * @var array | |
| 60 | */ | |
| 61 | public $i18n = array( | |
| 62 | 		'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
 | |
| 63 | 		'locale' => array('type' => 'string', 'null' => false, 'length' => 6, 'key' => 'index'),
 | |
| 64 | 		'model' => array('type' => 'string', 'null' => false, 'key' => 'index'),
 | |
| 65 | 		'foreign_key' => array('type' => 'integer', 'null' => false, 'length' => 10, 'key' => 'index'),
 | |
| 66 | 		'field' => array('type' => 'string', 'null' => false, 'key' => 'index'),
 | |
| 67 | 		'content' => array('type' => 'text', 'null' => true, 'default' => null),
 | |
| 68 | 		'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'locale' => array('column' => 'locale', 'unique' => 0), 'model' => array('column' => 'model', 'unique' => 0), 'row_id' => array('column' => 'foreign_key', 'unique' => 0), 'field' => array('column' => 'field', 'unique' => 0))
 | |
| 69 | ); | |
| 70 |  | |
| 71 | } | |
| app/Config/Schema/i18n.sql | ||
|---|---|---|
| 1 | # $Id$ | |
| 2 | # | |
| 3 | # Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) | |
| 4 | # | |
| 5 | # Licensed under The MIT License | |
| 6 | # For full copyright and license information, please see the LICENSE.txt | |
| 7 | # Redistributions of files must retain the above copyright notice. | |
| 8 | # MIT License (http://www.opensource.org/licenses/mit-license.php) | |
| 9 |  | |
| 10 | CREATE TABLE i18n ( | |
| 11 | id int(10) NOT NULL auto_increment, | |
| 12 | locale varchar(6) NOT NULL, | |
| 13 | model varchar(255) NOT NULL, | |
| 14 | foreign_key int(10) NOT NULL, | |
| 15 | field varchar(255) NOT NULL, | |
| 16 | content mediumtext, | |
| 17 | PRIMARY KEY (id), | |
| 18 | # UNIQUE INDEX I18N_LOCALE_FIELD(locale, model, foreign_key, field), | |
| 19 | # INDEX I18N_LOCALE_ROW(locale, model, foreign_key), | |
| 20 | # INDEX I18N_LOCALE_MODEL(locale, model), | |
| 21 | # INDEX I18N_FIELD(model, foreign_key, field), | |
| 22 | # INDEX I18N_ROW(model, foreign_key), | |
| 23 | INDEX locale (locale), | |
| 24 | INDEX model (model), | |
| 25 | INDEX row_id (foreign_key), | |
| 26 | INDEX field (field) | |
| 27 | ); | |
| app/Config/Schema/sessions.php | ||
|---|---|---|
| 1 | <?php | |
| 2 | /** | |
| 3 | * This is Sessions Schema file | |
| 4 | * | |
| 5 | * Use it to configure database for Sessions | |
| 6 | * | |
| 7 | * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) | |
| 8 | * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) | |
| 9 | * | |
| 10 | * Licensed under The MIT License | |
| 11 | * For full copyright and license information, please see the LICENSE.txt | |
| 12 | * Redistributions of files must retain the above copyright notice. | |
| 13 | * | |
| 14 | * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) | |
| 15 | * @link http://cakephp.org CakePHP(tm) Project | |
| 16 | * @package app.Config.Schema | |
| 17 | * @since CakePHP(tm) v 0.2.9 | |
| 18 | * @license http://www.opensource.org/licenses/mit-license.php MIT License | |
| 19 | */ | |
| 20 |  | |
| 21 | /** | |
| 22 | * Using the Schema command line utility | |
| 23 | * cake schema run create Sessions | |
| 24 | */ | |
| 25 | class SessionsSchema extends CakeSchema {
 | |
| 26 |  | |
| 27 | /** | |
| 28 | * Name property | |
| 29 | * | |
| 30 | * @var string | |
| 31 | */ | |
| 32 | public $name = 'Sessions'; | |
| 33 |  | |
| 34 | /** | |
| 35 | * Before callback. | |
| 36 | * | |
| 37 | * @param array $event Schema object properties | |
| 38 | * @return bool Should process continue | |
| 39 | */ | |
| 40 | 	public function before($event = array()) {
 | |
| 41 | return true; | |
| 42 | } | |
| 43 |  | |
| 44 | /** | |
| 45 | * After callback. | |
| 46 | * | |
| 47 | * @param array $event Schema object properties | |
| 48 | * @return void | |
| 49 | */ | |
| 50 | 	public function after($event = array()) {
 | |
| 51 | } | |
| 52 |  | |
| 53 | /** | |
| 54 | * The cake_sessions table definition | |
| 55 | * | |
| 56 | * @var array | |
| 57 | */ | |
| 58 | public $cake_sessions = array( | |
| 59 | 		'id' => array('type' => 'string', 'null' => false, 'key' => 'primary'),
 | |
| 60 | 		'data' => array('type' => 'text', 'null' => true, 'default' => null),
 | |
| 61 | 		'expires' => array('type' => 'integer', 'null' => true, 'default' => null),
 | |
| 62 | 		'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
 | |
| 63 | ); | |
| 64 |  | |
| 65 | } | |
| app/Config/Schema/sessions.sql | ||
|---|---|---|
| 1 | # $Id$ | |
| 2 | # | |
| 3 | # Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) | |
| 4 | # 1785 E. Sahara Avenue, Suite 490-204 | |
| 5 | # Las Vegas, Nevada 89104 | |
| 6 | # | |
| 7 | # Licensed under The MIT License | |
| 8 | # For full copyright and license information, please see the LICENSE.txt | |
| 9 | # Redistributions of files must retain the above copyright notice. | |
| 10 | # MIT License (http://www.opensource.org/licenses/mit-license.php) | |
| 11 |  | |
| 12 | CREATE TABLE cake_sessions ( | |
| 13 | id varchar(255) NOT NULL default '', | |
| 14 | data text, | |
| 15 | expires int(11) default NULL, | |
| 16 | PRIMARY KEY (id) | |
| 17 | ); | |
| app/Config/acl.ini.php | ||
|---|---|---|
| 1 | ;<?php exit() ?> | |
| 2 | ;/** | |
| 3 | ; * ACL Configuration | |
| 4 | ; * | |
| 5 | ; * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) | |
| 6 | ; * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) | |
| 7 | ; * | |
| 8 | ; * Licensed under The MIT License | |
| 9 | ; * Redistributions of files must retain the above copyright notice. | |
| 10 | ; * | |
| 11 | ; * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) | |
| 12 | ; * @link http://cakephp.org CakePHP(tm) Project | |
| 13 | ; * @package app.Config | |
| 14 | ; * @since CakePHP(tm) v 0.10.0.1076 | |
| 15 | ; * @license http://www.opensource.org/licenses/mit-license.php MIT License | |
| 16 | ; */ | |
| 17 |  | |
| 18 | ; acl.ini.php - CakePHP ACL Configuration | |
| 19 | ; --------------------------------------------------------------------- | |
| 20 | ; Use this file to specify user permissions. | |
| 21 | ; aco = access control object (something in your application) | |
| 22 | ; aro = access request object (something requesting access) | |
| 23 | ; | |
| 24 | ; User records are added as follows: | |
| 25 | ; | |
| 26 | ; [uid] | |
| 27 | ; groups = group1, group2, group3 | |
| 28 | ; allow = aco1, aco2, aco3 | |
| 29 | ; deny = aco4, aco5, aco6 | |
| 30 | ; | |
| 31 | ; Group records are added in a similar manner: | |
| 32 | ; | |
| 33 | ; [gid] | |
| 34 | ; allow = aco1, aco2, aco3 | |
| 35 | ; deny = aco4, aco5, aco6 | |
| 36 | ; | |
| 37 | ; The allow, deny, and groups sections are all optional. | |
| 38 | ; NOTE: groups names *cannot* ever be the same as usernames! | |
| 39 | ; | |
| 40 | ; ACL permissions are checked in the following order: | |
| 41 | ; 1. Check for user denies (and DENY if specified) | |
| 42 | ; 2. Check for user allows (and ALLOW if specified) | |
| 43 | ; 3. Gather user's groups | |
| 44 | ; 4. Check group denies (and DENY if specified) | |
| 45 | ; 5. Check group allows (and ALLOW if specified) | |
| 46 | ; 6. If no aro, aco, or group information is found, DENY | |
| 47 | ; | |
| 48 | ; --------------------------------------------------------------------- | |
| 49 |  | |
| 50 | ;------------------------------------- | |
| 51 | ;Users | |
| 52 | ;------------------------------------- | |
| 53 |  | |
| 54 | [username-goes-here] | |
| 55 | groups = group1, group2 | |
| 56 | deny = aco1, aco2 | |
| 57 | allow = aco3, aco4 | |
| 58 |  | |
| 59 | ;------------------------------------- | |
| 60 | ;Groups | |
| 61 | ;------------------------------------- | |
| 62 |  | |
| 63 | [groupname-goes-here] | |
| 64 | deny = aco5, aco6 | |
| 65 | allow = aco7, aco8 | |
| app/Config/acl.php | ||
|---|---|---|
| 1 | <?php | |
| 2 | /** | |
| 3 | * This is the PHP base ACL configuration file. | |
| 4 | * | |
| 5 | * Use it to configure access control of your CakePHP application. | |
| 6 | * | |
| 7 | * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) | |
| 8 | * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) | |
| 9 | * | |
| 10 | * Licensed under The MIT License | |
| 11 | * For full copyright and license information, please see the LICENSE.txt | |
| 12 | * Redistributions of files must retain the above copyright notice. | |
| 13 | * | |
| 14 | * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) | |
| 15 | * @link http://cakephp.org CakePHP(tm) Project | |
| 16 | * @package app.Config | |
| 17 | * @since CakePHP(tm) v 2.1 | |
| 18 | * @license http://www.opensource.org/licenses/mit-license.php MIT License | |
| 19 | */ | |
| 20 |  | |
| 21 | /** | |
| 22 | * Example | |
| 23 | * ------- | |
| 24 | * | |
| 25 | * Assumptions: | |
| 26 | * | |
| 27 | * 1. In your application you created a User model with the following properties: | |
| 28 | * username, group_id, password, email, firstname, lastname and so on. | |
| 29 | * 2. You configured AuthComponent to authorize actions via | |
| 30 |  *    $this->Auth->authorize = array('Actions' => array('actionPath' => 'controllers/'),...)
 | |
| 31 | * | |
| 32 | * Now, when a user (i.e. jeff) authenticates successfully and requests a controller action (i.e. /invoices/delete) | |
| 33 |  * that is not allowed by default (e.g. via $this->Auth->allow('edit') in the Invoices controller) then AuthComponent
 | |
| 34 | * will ask the configured ACL interface if access is granted. Under the assumptions 1. and 2. this will be | |
| 35 | * done via a call to Acl->check() with | |
| 36 | * | |
| 37 | * ``` | |
| 38 |  * array('User' => array('username' => 'jeff', 'group_id' => 4, ...))
 | |
| 39 | * ``` | |
| 40 | * | |
| 41 | * as ARO and | |
| 42 | * | |
| 43 | * ``` | |
| 44 | * '/controllers/invoices/delete' | |
| 45 | * ``` | |
| 46 | * | |
| 47 | * as ACO. | |
| 48 | * | |
| 49 | * If the configured map looks like | |
| 50 | * | |
| 51 | * ``` | |
| 52 | * $config['map'] = array( | |
| 53 | * 'User' => 'User/username', | |
| 54 | * 'Role' => 'User/group_id', | |
| 55 | * ); | |
| 56 | * ``` | |
| 57 | * | |
| 58 | * then PhpAcl will lookup if we defined a role like User/jeff. If that role is not found, PhpAcl will try to | |
| 59 | * find a definition for Role/4. If the definition isn't found then a default role (Role/default) will be used to | |
| 60 | * check rules for the given ACO. The search can be expanded by defining aliases in the alias configuration. | |
| 61 | * E.g. if you want to use a more readable name than Role/4 in your definitions you can define an alias like | |
| 62 | * | |
| 63 | * ``` | |
| 64 | * $config['alias'] = array( | |
| 65 | * 'Role/4' => 'Role/editor', | |
| 66 | * ); | |
| 67 | * ``` | |
| 68 | * | |
| 69 | * In the roles configuration you can define roles on the lhs and inherited roles on the rhs: | |
| 70 | * | |
| 71 | * ``` | |
| 72 | * $config['roles'] = array( | |
| 73 | * 'Role/admin' => null, | |
| 74 | * 'Role/accountant' => null, | |
| 75 | * 'Role/editor' => null, | |
| 76 | * 'Role/manager' => 'Role/editor, Role/accountant', | |
| 77 | * 'User/jeff' => 'Role/manager', | |
| 78 | * ); | |
| 79 | * ``` | |
| 80 | * | |
| 81 | * In this example manager inherits all rules from editor and accountant. Role/admin doesn't inherit from any role. | |
| 82 | * Lets define some rules: | |
| 83 | * | |
| 84 | * ``` | |
| 85 | * $config['rules'] = array( | |
| 86 | * 'allow' => array( | |
| 87 | * '*' => 'Role/admin', | |
| 88 | * 'controllers/users/(dashboard|profile)' => 'Role/default', | |
| 89 | * 'controllers/invoices/*' => 'Role/accountant', | |
| 90 | * 'controllers/articles/*' => 'Role/editor', | |
| 91 | * 'controllers/users/*' => 'Role/manager', | |
| 92 | * 'controllers/invoices/delete' => 'Role/manager', | |
| 93 | * ), | |
| 94 | * 'deny' => array( | |
| 95 | * 'controllers/invoices/delete' => 'Role/accountant, User/jeff', | |
| 96 | * 'controllers/articles/(delete|publish)' => 'Role/editor', | |
| 97 | * ), | |
| 98 | * ); | |
| 99 | * ``` | |
| 100 | * | |
| 101 | * Ok, so as jeff inherits from Role/manager he's matched every rule that references User/jeff, Role/manager, | |
| 102 | * Role/editor, and Role/accountant. However, for jeff, rules for User/jeff are more specific than | |
| 103 | * rules for Role/manager, rules for Role/manager are more specific than rules for Role/editor and so on. | |
| 104 | * This is important when allow and deny rules match for a role. E.g. Role/accountant is allowed | |
| 105 | * controllers/invoices/* but at the same time controllers/invoices/delete is denied. But there is a more | |
| 106 | * specific rule defined for Role/manager which is allowed controllers/invoices/delete. However, the most specific | |
| 107 | * rule denies access to the delete action explicitly for User/jeff, so he'll be denied access to the resource. | |
| 108 | * | |
| 109 | * If we would remove the role definition for User/jeff, then jeff would be granted access as he would be resolved | |
| 110 | * to Role/manager and Role/manager has an allow rule. | |
| 111 | */ | |
| 112 |  | |
| 113 | /** | |
| 114 | * The role map defines how to resolve the user record from your application | |
| 115 | * to the roles you defined in the roles configuration. | |
| 116 | */ | |
| 117 | $config['map'] = array( | |
| 118 | 'User' => 'User/username', | |
| 119 | 'Role' => 'User/group_id', | |
| 120 | ); | |
| 121 |  | |
| 122 | /** | |
| 123 | * define aliases to map your model information to | |
| 124 | * the roles defined in your role configuration. | |
| 125 | */ | |
| 126 | $config['alias'] = array( | |
| 127 | 'Role/4' => 'Role/editor', | |
| 128 | ); | |
| 129 |  | |
| 130 | /** | |
| 131 | * role configuration | |
| 132 | */ | |
| 133 | $config['roles'] = array( | |
| 134 | 'Role/admin' => null, | |
| 135 | ); | |
| 136 |  | |
| 137 | /** | |
| 138 | * rule configuration | |
| 139 | */ | |
| 140 | $config['rules'] = array( | |
| 141 | 'allow' => array( | |
| 142 | '*' => 'Role/admin', | |
| 143 | ), | |
| 144 | 'deny' => array(), | |
| 145 | ); | |
| app/Config/bootstrap.php | ||
|---|---|---|
| 1 | <?php | |
| 2 | /** | |
| 3 | * This file is loaded automatically by the app/webroot/index.php file after core.php | |
| 4 | * | |
| 5 | * This file should load/create any application wide configuration settings, such as | |
| 6 | * Caching, Logging, loading additional configuration files. | |
| 7 | * | |
| 8 | * You should also use this file to include any files that provide global functions/constants | |
| 9 | * that your application uses. | |
| 10 | * | |
| 11 | * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) | |
| 12 | * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) | |
| 13 | * | |
| 14 | * Licensed under The MIT License | |
| 15 | * For full copyright and license information, please see the LICENSE.txt | |
| 16 | * Redistributions of files must retain the above copyright notice. | |
| 17 | * | |
| 18 | * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) | |
| 19 | * @link http://cakephp.org CakePHP(tm) Project | |
| 20 | * @package app.Config | |
| 21 | * @since CakePHP(tm) v 0.10.8.2117 | |
| 22 | * @license http://www.opensource.org/licenses/mit-license.php MIT License | |
| 23 | */ | |
| 24 |  | |
| 25 | // Setup a 'default' cache configuration for use in the application. | |
| 26 | Cache::config('default', array('engine' => 'File'));
 | |
| 27 |  | |
| 28 | /** | |
| 29 | * The settings below can be used to set additional paths to models, views and controllers. | |
| 30 | * | |
| 31 | * App::build(array( | |
| 32 |  *     'Model'                     => array('/path/to/models/', '/next/path/to/models/'),
 | |
| 33 |  *     'Model/Behavior'            => array('/path/to/behaviors/', '/next/path/to/behaviors/'),
 | |
| 34 |  *     'Model/Datasource'          => array('/path/to/datasources/', '/next/path/to/datasources/'),
 | |
| 35 |  *     'Model/Datasource/Database' => array('/path/to/databases/', '/next/path/to/database/'),
 | |
| 36 |  *     'Model/Datasource/Session'  => array('/path/to/sessions/', '/next/path/to/sessions/'),
 | |
| 37 |  *     'Controller'                => array('/path/to/controllers/', '/next/path/to/controllers/'),
 | |
| 38 |  *     'Controller/Component'      => array('/path/to/components/', '/next/path/to/components/'),
 | |
| 39 |  *     'Controller/Component/Auth' => array('/path/to/auths/', '/next/path/to/auths/'),
 | |
| 40 |  *     'Controller/Component/Acl'  => array('/path/to/acls/', '/next/path/to/acls/'),
 | |
| 41 |  *     'View'                      => array('/path/to/views/', '/next/path/to/views/'),
 | |
| 42 |  *     'View/Helper'               => array('/path/to/helpers/', '/next/path/to/helpers/'),
 | |
| 43 |  *     'Console'                   => array('/path/to/consoles/', '/next/path/to/consoles/'),
 | |
| 44 |  *     'Console/Command'           => array('/path/to/commands/', '/next/path/to/commands/'),
 | |
| 45 |  *     'Console/Command/Task'      => array('/path/to/tasks/', '/next/path/to/tasks/'),
 | |
| 46 |  *     'Lib'                       => array('/path/to/libs/', '/next/path/to/libs/'),
 | |
| 47 |  *     'Locale'                    => array('/path/to/locales/', '/next/path/to/locales/'),
 | |
| 48 |  *     'Vendor'                    => array('/path/to/vendors/', '/next/path/to/vendors/'),
 | |
| 49 |  *     'Plugin'                    => array('/path/to/plugins/', '/next/path/to/plugins/'),
 | |
| 50 | * )); | |
| 51 | */ | |
| 52 |  | |
| 53 | /** | |
| 54 | * Custom Inflector rules can be set to correctly pluralize or singularize table, model, controller names or whatever other | |
| 55 | * string is passed to the inflection functions | |
| 56 | * | |
| 57 |  * Inflector::rules('singular', array('rules' => array(), 'irregular' => array(), 'uninflected' => array()));
 | |
| 58 |  * Inflector::rules('plural', array('rules' => array(), 'irregular' => array(), 'uninflected' => array()));
 | |
| 59 | */ | |
| 60 |  | |
| 61 | /** | |
| 62 | * Plugins need to be loaded manually, you can either load them one by one or all of them in a single call | |
| 63 | * Uncomment one of the lines below, as you need. Make sure you read the documentation on CakePlugin to use more | |
| 64 | * advanced ways of loading plugins | |
| 65 | * | |
| 66 | * CakePlugin::loadAll(); // Loads all plugins at once | |
| 67 |  * CakePlugin::load('DebugKit'); // Loads a single plugin named DebugKit
 | |
| 68 | */ | |
| 69 |  | |
| 70 | /** | |
| 71 | * To prefer app translation over plugin translation, you can set | |
| 72 | * | |
| 73 |  * Configure::write('I18n.preferApp', true);
 | |
| 74 | */ | |
| 75 |  | |
| 76 | /** | |
| 77 | * You can attach event listeners to the request lifecycle as Dispatcher Filter. By default CakePHP bundles two filters: | |
| 78 | * | |
| 79 | * - AssetDispatcher filter will serve your asset files (css, images, js, etc) from your themes and plugins | |
| 80 | * - CacheDispatcher filter will read the Cache.check configure variable and try to serve cached content generated from controllers | |
| 81 | * | |
| 82 | * Feel free to remove or add filters as you see fit for your application. A few examples: | |
| 83 | * | |
| 84 |  * Configure::write('Dispatcher.filters', array(
 | |
| 85 | * 'MyCacheFilter', // will use MyCacheFilter class from the Routing/Filter package in your app. | |
| 86 |  *		'MyCacheFilter' => array('prefix' => 'my_cache_'), //  will use MyCacheFilter class from the Routing/Filter package in your app with settings array.
 | |
| 87 | * 'MyPlugin.MyFilter', // will use MyFilter class from the Routing/Filter package in MyPlugin plugin. | |
| 88 |  *		array('callable' => $aFunction, 'on' => 'before', 'priority' => 9), // A valid PHP callback type to be called on beforeDispatch
 | |
| 89 |  *		array('callable' => $anotherMethod, 'on' => 'after'), // A valid PHP callback type to be called on afterDispatch
 | |
| 90 | * | |
| 91 | * )); | |
| 92 | */ | |
| 93 | Configure::write('Dispatcher.filters', array(
 | |
| 94 | 'AssetDispatcher', | |
| 95 | 'CacheDispatcher' | |
| 96 | )); | |
| 97 |  | |
| 98 | /** | |
| 99 | * Configures default file logging options | |
| 100 | */ | |
| 101 | App::uses('CakeLog', 'Log');
 | |
| 102 | CakeLog::config('debug', array(
 | |
| 103 | 'engine' => 'File', | |
| 104 | 	'types' => array('notice', 'info', 'debug'),
 | |
| 105 | 'file' => 'debug', | |
| 106 | )); | |
| 107 | CakeLog::config('error', array(
 | |
| 108 | 'engine' => 'File', | |
| 109 | 	'types' => array('warning', 'error', 'critical', 'alert', 'emergency'),
 | |
| 110 | 'file' => 'error', | |
| 111 | )); | |
| app/Config/core.php | ||
|---|---|---|
| 1 | <?php | |
| 2 | /** | |
| 3 | * This is core configuration file. | |
| 4 | * | |
| 5 | * Use it to configure core behavior of Cake. | |
| 6 | * | |
| 7 | * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) | |
| 8 | * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) | |
| 9 | * | |
| 10 | * Licensed under The MIT License | |
| 11 | * For full copyright and license information, please see the LICENSE.txt | |
| 12 | * Redistributions of files must retain the above copyright notice. | |
| 13 | * | |
| 14 | * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) | |
| 15 | * @link http://cakephp.org CakePHP(tm) Project | |
| 16 | * @package app.Config | |
| 17 | * @since CakePHP(tm) v 0.2.9 | |
| 18 | * @license http://www.opensource.org/licenses/mit-license.php MIT License | |
| 19 | */ | |
| 20 |  | |
| 21 | //setLocale(LC_ALL, 'deu'); | |
| 22 | //Configure::write('Config.language', 'deu');
 | |
| 23 |  | |
| 24 | /** | |
| 25 | * CakePHP Debug Level: | |
| 26 | * | |
| 27 | * Production Mode: | |
| 28 | * 0: No error messages, errors, or warnings shown. Flash messages redirect. | |
| 29 | * | |
| 30 | * Development Mode: | |
| 31 | * 1: Errors and warnings shown, model caches refreshed, flash messages halted. | |
| 32 | * 2: As in 1, but also with full debug messages and SQL output. | |
| 33 | * | |
| 34 | * In production mode, flash messages redirect after a time interval. | |
| 35 | * In development mode, you need to click the flash message to continue. | |
| 36 | */ | |
| 37 | 	Configure::write('debug', 2);
 | |
| 38 |  | |
| 39 | /** | |
| 40 | * Configure the Error handler used to handle errors for your application. By default | |
| 41 | * ErrorHandler::handleError() is used. It will display errors using Debugger, when debug > 0 | |
| 42 | * and log errors with CakeLog when debug = 0. | |
| 43 | * | |
| 44 | * Options: | |
| 45 | * | |
| 46 | * - `handler` - callback - The callback to handle errors. You can set this to any callable type, | |
| 47 | * including anonymous functions. | |
| 48 |  *   Make sure you add App::uses('MyHandler', 'Error'); when using a custom handler class
 | |
| 49 | * - `level` - integer - The level of errors you are interested in capturing. | |
| 50 | * - `trace` - boolean - Include stack traces for errors in log files. | |
| 51 | * | |
| 52 | * @see ErrorHandler for more information on error handling and configuration. | |
| 53 | */ | |
| 54 | 	Configure::write('Error', array(
 | |
| 55 | 'handler' => 'ErrorHandler::handleError', | |
| 56 | 'level' => E_ALL & ~E_DEPRECATED, | |
| 57 | 'trace' => true | |
| 58 | )); | |
| 59 |  | |
| 60 | /** | |
| 61 | * Configure the Exception handler used for uncaught exceptions. By default, | |
| 62 | * ErrorHandler::handleException() is used. It will display a HTML page for the exception, and | |
| 63 | * while debug > 0, framework errors like Missing Controller will be displayed. When debug = 0, | |
| 64 | * framework errors will be coerced into generic HTTP errors. | |
| 65 | * | |
| 66 | * Options: | |
| 67 | * | |
| 68 | * - `handler` - callback - The callback to handle exceptions. You can set this to any callback type, | |
| 69 | * including anonymous functions. | |
| 70 |  *   Make sure you add App::uses('MyHandler', 'Error'); when using a custom handler class
 | |
| 71 | * - `renderer` - string - The class responsible for rendering uncaught exceptions. If you choose a custom class you | |
| 72 | * should place the file for that class in app/Lib/Error. This class needs to implement a render method. | |
| 73 | * - `log` - boolean - Should Exceptions be logged? | |
| 74 | * - `skipLog` - array - list of exceptions to skip for logging. Exceptions that | |
| 75 | * extend one of the listed exceptions will also be skipped for logging. | |
| 76 |  *   Example: `'skipLog' => array('NotFoundException', 'UnauthorizedException')`
 | |
| 77 | * | |
| 78 | * @see ErrorHandler for more information on exception handling and configuration. | |
| 79 | */ | |
| 80 | 	Configure::write('Exception', array(
 | |
| 81 | 'handler' => 'ErrorHandler::handleException', | |
| 82 | 'renderer' => 'ExceptionRenderer', | |
| 83 | 'log' => true | |
| 84 | )); | |
| 85 |  | |
| 86 | /** | |
| 87 | * Application wide charset encoding | |
| 88 | */ | |
| 89 | 	Configure::write('App.encoding', 'UTF-8');
 | |
| 90 |  | |
| 91 | /** | |
| 92 | * To configure CakePHP *not* to use mod_rewrite and to | |
| 93 | * use CakePHP pretty URLs, remove these .htaccess | |
| 94 | * files: | |
| 95 | * | |
| 96 | * /.htaccess | |
| 97 | * /app/.htaccess | |
| 98 | * /app/webroot/.htaccess | |
| 99 | * | |
| 100 | * And uncomment the App.baseUrl below. But keep in mind | |
| 101 | * that plugin assets such as images, CSS and JavaScript files | |
| 102 | * will not work without URL rewriting! | |
| 103 | * To work around this issue you should either symlink or copy | |
| 104 | * the plugin assets into you app's webroot directory. This is | |
| 105 | * recommended even when you are using mod_rewrite. Handling static | |
| 106 | * assets through the Dispatcher is incredibly inefficient and | |
| 107 | * included primarily as a development convenience - and | |
| 108 | * thus not recommended for production applications. | |
| 109 | */ | |
| 110 | 	//Configure::write('App.baseUrl', env('SCRIPT_NAME'));
 | |
| 111 |  | |
| 112 | /** | |
| 113 | * To configure CakePHP to use a particular domain URL | |
| 114 | * for any URL generation inside the application, set the following | |
| 115 | * configuration variable to the http(s) address to your domain. This | |
| 116 | * will override the automatic detection of full base URL and can be | |
| 117 | * useful when generating links from the CLI (e.g. sending emails) | |
| 118 | */ | |
| 119 | 	//Configure::write('App.fullBaseUrl', 'http://example.com');
 | |
| 120 |  | |
| 121 | /** | |
| 122 | * Web path to the public images directory under webroot. | |
| 123 | * If not set defaults to 'img/' | |
| 124 | */ | |
| 125 | 	//Configure::write('App.imageBaseUrl', 'img/');
 | |
| 126 |  | |
| 127 | /** | |
| 128 | * Web path to the CSS files directory under webroot. | |
| 129 | * If not set defaults to 'css/' | |
| 130 | */ | |
| 131 | 	//Configure::write('App.cssBaseUrl', 'css/');
 | |
| 132 |  | |
| 133 | /** | |
| 134 | * Web path to the js files directory under webroot. | |
| 135 | * If not set defaults to 'js/' | |
| 136 | */ | |
| 137 | 	//Configure::write('App.jsBaseUrl', 'js/');
 | |
| 138 |  | |
| 139 | /** | |
| 140 | * Uncomment the define below to use CakePHP prefix routes. | |
| 141 | * | |
| 142 | * The value of the define determines the names of the routes | |
| 143 | * and their associated controller actions: | |
| 144 | * | |
| 145 | * Set to an array of prefixes you want to use in your application. Use for | |
| 146 | * admin or other prefixed routes. | |
| 147 | * | |
| 148 |  * 	Routing.prefixes = array('admin', 'manager');
 | |
| 149 | * | |
| 150 | * Enables: | |
| 151 | * `admin_index()` and `/admin/controller/index` | |
| 152 | * `manager_index()` and `/manager/controller/index` | |
| 153 | */ | |
| 154 | 	//Configure::write('Routing.prefixes', array('admin'));
 | |
| 155 |  | |
| 156 | /** | |
| 157 | * Turn off all caching application-wide. | |
| 158 | */ | |
| 159 | 	//Configure::write('Cache.disable', true);
 | |
| 160 |  | |
| 161 | /** | |
| 162 | * Enable cache checking. | |
| 163 | * | |
| 164 | * If set to true, for view caching you must still use the controller | |
| 165 | * public $cacheAction inside your controllers to define caching settings. | |
| 166 | * You can either set it controller-wide by setting public $cacheAction = true, | |
| 167 | * or in each action using $this->cacheAction = true. | |
| 168 | */ | |
| 169 | 	//Configure::write('Cache.check', true);
 | |
| 170 |  | |
| 171 | /** | |
| 172 | * Enable cache view prefixes. | |
| 173 | * | |
| 174 | * If set it will be prepended to the cache name for view file caching. This is | |
| 175 | * helpful if you deploy the same application via multiple subdomains and languages, | |
| 176 | * for instance. Each version can then have its own view cache namespace. | |
| 177 | * Note: The final cache file name will then be `prefix_cachefilename`. | |
| 178 | */ | |
| 179 | 	//Configure::write('Cache.viewPrefix', 'prefix');
 | |
| 180 |  | |
| 181 | /** | |
| 182 | * Session configuration. | |
| 183 | * | |
| 184 | * Contains an array of settings to use for session configuration. The defaults key is | |
| 185 | * used to define a default preset to use for sessions, any settings declared here will override | |
| 186 | * the settings of the default config. | |
| 187 | * | |
| 188 | * ## Options | |
| 189 | * | |
| 190 | * - `Session.cookie` - The name of the cookie to use. Defaults to 'CAKEPHP' | |
| 191 | * - `Session.timeout` - The number of minutes you want sessions to live for. This timeout is handled by CakePHP | |
| 192 | * - `Session.cookieTimeout` - The number of minutes you want session cookies to live for. | |
| 193 | * - `Session.checkAgent` - Do you want the user agent to be checked when starting sessions? You might want to set the | |
| 194 | * value to false, when dealing with older versions of IE, Chrome Frame or certain web-browsing devices and AJAX | |
| 195 | * - `Session.defaults` - The default configuration set to use as a basis for your session. | |
| 196 | * There are four builtins: php, cake, cache, database. | |
| 197 | * - `Session.handler` - Can be used to enable a custom session handler. Expects an array of callables, | |
| 198 | * that can be used with `session_save_handler`. Using this option will automatically add `session.save_handler` | |
| 199 | * to the ini array. | |
| 200 | * - `Session.autoRegenerate` - Enabling this setting, turns on automatic renewal of sessions, and | |
| 201 | * sessionids that change frequently. See CakeSession::$requestCountdown. | |
| 202 | * - `Session.ini` - An associative array of additional ini values to set. | |
| 203 | * | |
| 204 | * The built in defaults are: | |
| 205 | * | |
| 206 | * - 'php' - Uses settings defined in your php.ini. | |
| 207 | * - 'cake' - Saves session files in CakePHP's /tmp directory. | |
| 208 | * - 'database' - Uses CakePHP's database sessions. | |
| 209 | * - 'cache' - Use the Cache class to save sessions. | |
| 210 | * | |
| 211 | * To define a custom session handler, save it at /app/Model/Datasource/Session/<name>.php. | |
| 212 | * Make sure the class implements `CakeSessionHandlerInterface` and set Session.handler to <name> | |
| 213 | * | |
| 214 | * To use database sessions, run the app/Config/Schema/sessions.php schema using | |
| 215 | * the cake shell command: cake schema create Sessions | |
| 216 | */ | |
| 217 | 	Configure::write('Session', array(
 | |
| 218 | 'defaults' => 'php' | |
| 219 | )); | |
| 220 |  | |
| 221 | /** | |
| 222 | * A random string used in security hashing methods. | |
| 223 | */ | |
| 224 | 	Configure::write('Security.salt', 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi');
 | |
| 225 |  | |
| 226 | /** | |
| 227 | * A random numeric string (digits only) used to encrypt/decrypt strings. | |
| 228 | */ | |
| 229 | 	Configure::write('Security.cipherSeed', '76859309657453542496749683645');
 | |
| 230 |  | |
| 231 | /** | |
| 232 | * Apply timestamps with the last modified time to static assets (js, css, images). | |
| 233 | * Will append a query string parameter containing the time the file was modified. This is | |
| 234 | * useful for invalidating browser caches. | |
| 235 | * | |
| 236 | * Set to `true` to apply timestamps when debug > 0. Set to 'force' to always enable | |
| 237 | * timestamping regardless of debug value. | |
| 238 | */ | |
| 239 | 	//Configure::write('Asset.timestamp', true);
 | |
| 240 |  | |
| 241 | /** | |
| 242 | * Compress CSS output by removing comments, whitespace, repeating tags, etc. | |
| 243 | * This requires a/var/cache directory to be writable by the web server for caching. | |
| 244 | * and /vendors/csspp/csspp.php | |
| 245 | * | |
| 246 | * To use, prefix the CSS link URL with '/ccss/' instead of '/css/' or use HtmlHelper::css(). | |
| 247 | */ | |
| 248 | 	//Configure::write('Asset.filter.css', 'css.php');
 | |
| 249 |  | |
| 250 | /** | |
| 251 | * Plug in your own custom JavaScript compressor by dropping a script in your webroot to handle the | |
| 252 | * output, and setting the config below to the name of the script. | |
| 253 | * | |
| 254 | * To use, prefix your JavaScript link URLs with '/cjs/' instead of '/js/' or use JsHelper::link(). | |
| 255 | */ | |
| 256 | 	//Configure::write('Asset.filter.js', 'custom_javascript_output_filter.php');
 | |
| 257 |  | |
| 258 | /** | |
| 259 | * The class name and database used in CakePHP's | |
| 260 | * access control lists. | |
| 261 | */ | |
| 262 | 	Configure::write('Acl.classname', 'DbAcl');
 | |
| 263 | 	Configure::write('Acl.database', 'default');
 | |
| 264 |  | |
| 265 | /** | |
| 266 | * Uncomment this line and correct your server timezone to fix | |
| 267 | * any date & time related errors. | |
| 268 | */ | |
| 269 | 	//date_default_timezone_set('UTC');
 | |
| 270 |  | |
| 271 | /** | |
| 272 | * `Config.timezone` is available in which you can set users' timezone string. | |
| 273 | * If a method of CakeTime class is called with $timezone parameter as null and `Config.timezone` is set, | |
| 274 | * then the value of `Config.timezone` will be used. This feature allows you to set users' timezone just | |
| 275 | * once instead of passing it each time in function calls. | |
| 276 | */ | |
| 277 | 	//Configure::write('Config.timezone', 'Europe/Paris');
 | |
| 278 |  | |
| 279 | /** | |
| 280 | * Cache Engine Configuration | |
| 281 | * Default settings provided below | |
| 282 | * | |
| 283 | * File storage engine. | |
| 284 | * | |
| 285 |  * 	 Cache::config('default', array(
 | |
| 286 | * 'engine' => 'File', //[required] | |
| 287 | * 'duration' => 3600, //[optional] | |
| 288 | * 'probability' => 100, //[optional] | |
| 289 | * 'path' => CACHE, //[optional] use system tmp directory - remember to use absolute path | |
| 290 | * 'prefix' => 'cake_', //[optional] prefix every cache file with this string | |
| 291 | * 'lock' => false, //[optional] use file locking | |
| 292 | * 'serialize' => true, //[optional] | |
| 293 | * 'mask' => 0664, //[optional] | |
| 294 | * )); | |
| 295 | * | |
| 296 | * APC (http://pecl.php.net/package/APC) | |
| 297 | * | |
| 298 |  * 	 Cache::config('default', array(
 | |
| 299 | * 'engine' => 'Apc', //[required] | |
| 300 | * 'duration' => 3600, //[optional] | |
| 301 | * 'probability' => 100, //[optional] | |
| 302 | * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string | |
| 303 | * )); | |
| 304 | * | |
| 305 | * Xcache (http://xcache.lighttpd.net/) | |
| 306 | * | |
| 307 |  * 	 Cache::config('default', array(
 | |
| 308 | * 'engine' => 'Xcache', //[required] | |
| 309 | * 'duration' => 3600, //[optional] | |
| 310 | * 'probability' => 100, //[optional] | |
| 311 | * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string | |
| 312 | * 'user' => 'user', //user from xcache.admin.user settings | |
| 313 | * 'password' => 'password', //plaintext password (xcache.admin.pass) | |
| 314 | * )); | |
| 315 | * | |
| 316 | * Memcached (http://www.danga.com/memcached/) | |
| 317 | * | |
| 318 | * Uses the memcached extension. See http://php.net/memcached | |
| 319 | * | |
| 320 |  * 	 Cache::config('default', array(
 | |
| 321 | * 'engine' => 'Memcached', //[required] | |
| 322 | * 'duration' => 3600, //[optional] | |
| 323 | * 'probability' => 100, //[optional] | |
| 324 | * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string | |
| 325 | * 'servers' => array( | |
| 326 | * '127.0.0.1:11211' // localhost, default port 11211 | |
| 327 | * ), //[optional] | |
| 328 | * 'persistent' => 'my_connection', // [optional] The name of the persistent connection. | |
| 329 | * 'compress' => false, // [optional] compress data in Memcached (slower, but uses less memory) | |
| 330 | * )); | |
| 331 | * | |
| 332 | * Wincache (http://php.net/wincache) | |
| 333 | * | |
| 334 |  * 	 Cache::config('default', array(
 | |
| 335 | * 'engine' => 'Wincache', //[required] | |
| 336 | * 'duration' => 3600, //[optional] | |
| 337 | * 'probability' => 100, //[optional] | |
| 338 | * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string | |
| 339 | * )); | |
| 340 | */ | |
| 341 |  | |
| 342 | /** | |
| 343 | * Configure the cache handlers that CakePHP will use for internal | |
| 344 | * metadata like class maps, and model schema. | |
| 345 | * | |
| 346 | * By default File is used, but for improved performance you should use APC. | |
| 347 | * | |
| 348 | * Note: 'default' and other application caches should be configured in app/Config/bootstrap.php. | |
| 349 | * Please check the comments in bootstrap.php for more info on the cache engines available | |
| 350 | * and their settings. | |
| 351 | */ | |
| 352 | $engine = 'File'; | |
| 353 |  | |
| 354 | // In development mode, caches should expire quickly. | |
| 355 | $duration = '+999 days'; | |
| 356 | if (Configure::read('debug') > 0) {
 | |
| 357 | $duration = '+10 seconds'; | |
| 358 | } | |
| 359 |  | |
| 360 | // Prefix each application on the same server with a different string, to avoid Memcache and APC conflicts. | |
| 361 | $prefix = 'myapp_'; | |
| 362 |  | |
| 363 | /** | |
| 364 | * Configure the cache used for general framework caching. Path information, | |
| 365 | * object listings, and translation cache files are stored with this configuration. | |
| 366 | */ | |
| 367 | Cache::config('_cake_core_', array(
 | |
| 368 | 'engine' => $engine, | |
| 369 | 'prefix' => $prefix . 'cake_core_', | |
| 370 | 'path' => CACHE . 'persistent' . DS, | |
| 371 | 'serialize' => ($engine === 'File'), | |
| 372 | 'duration' => $duration | |
| 373 | )); | |
| 374 |  | |
| 375 | /** | |
| 376 | * Configure the cache for model and datasource caches. This cache configuration | |
| 377 | * is used to store schema descriptions, and table listings in connections. | |
| 378 | */ | |
他の形式にエクスポート: Unified diff