diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..217a0e3 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +; This file is for unifying the coding style for different editors and IDEs. +; More information at http://editorconfig.org + +root = true + +[*] +indent_style = tab +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.bat] +end_of_line = crlf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bc5c280 --- /dev/null +++ b/.gitignore @@ -0,0 +1,33 @@ +# User specific & automatically generated files # +################################################# +/app/Config/core.php +/app/Config/database.php +/app/Config/email.php +/app/webroot/uploads/ +/app/webroot/img/avatar/ +/app/webroot/dreamjob/ +/app/webroot/img/service/ +/app/tmp +/lib/Cake/Console/Templates/skel/tmp/ +/plugins +/vendors +/build +/dist +/tags +upload.sh +upload-produktiv.sh +.*.swp +*daten.sql +*~ + +# OS generated files # +###################### +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +Icon? +ehthumbs.db +Thumbs.db +/nbproject/ diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..417c613 --- /dev/null +++ b/.htaccess @@ -0,0 +1,5 @@ + + RewriteEngine on + RewriteRule ^$ app/webroot/ [L] + RewriteRule (.*) app/webroot/$1 [L] + diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..3a9e45b --- /dev/null +++ b/.travis.yml @@ -0,0 +1,118 @@ +language: php + +php: + - 5.2 + - 5.3 + - 5.4 + - 5.5 + +env: + - DB=mysql + - DB=pgsql + - DB=sqlite + +matrix: + include: + - php: 5.4 + env: + - PHPCS=1 + +before_script: + - sudo locale-gen de_DE + - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test;'; fi" + - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test2;'; fi" + - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test3;'; fi" + - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE DATABASE cakephp_test;' -U postgres; fi" + - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE SCHEMA test2;' -U postgres -d cakephp_test; fi" + - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE SCHEMA test3;' -U postgres -d cakephp_test; fi" + - chmod -R 777 ./app/tmp + - sudo apt-get install lighttpd + - sh -c "if [ '$PHPCS' = '1' ]; then pear channel-discover pear.cakephp.org; fi" + - sh -c "if [ '$PHPCS' = '1' ]; then pear install --alldeps cakephp/CakePHP_CodeSniffer; fi" + - phpenv rehash + - set +H + - echo " array( + 'datasource' => 'Database/Mysql', + 'host' => '0.0.0.0', + 'login' => 'travis' + ), + 'pgsql' => array( + 'datasource' => 'Database/Postgres', + 'host' => '127.0.0.1', + 'login' => 'postgres', + 'database' => 'cakephp_test', + 'schema' => array( + 'default' => 'public', + 'test' => 'public', + 'test2' => 'test2', + 'test_database_three' => 'test3' + ) + ), + 'sqlite' => array( + 'datasource' => 'Database/Sqlite', + 'database' => array( + 'default' => ':memory:', + 'test' => ':memory:', + 'test2' => '/tmp/cakephp_test2.db', + 'test_database_three' => '/tmp/cakephp_test3.db' + ), + ) + ); + public \$default = array( + 'persistent' => false, + 'host' => '', + 'login' => '', + 'password' => '', + 'database' => 'cakephp_test', + 'prefix' => '' + ); + public \$test = array( + 'persistent' => false, + 'host' => '', + 'login' => '', + 'password' => '', + 'database' => 'cakephp_test', + 'prefix' => '' + ); + public \$test2 = array( + 'persistent' => false, + 'host' => '', + 'login' => '', + 'password' => '', + 'database' => 'cakephp_test2', + 'prefix' => '' + ); + public \$test_database_three = array( + 'persistent' => false, + 'host' => '', + 'login' => '', + 'password' => '', + 'database' => 'cakephp_test3', + 'prefix' => '' + ); + public function __construct() { + \$db = 'mysql'; + if (!empty(\$_SERVER['DB'])) { + \$db = \$_SERVER['DB']; + } + foreach (array('default', 'test', 'test2', 'test_database_three') as \$source) { + \$config = array_merge(\$this->{\$source}, \$this->identities[\$db]); + if (is_array(\$config['database'])) { + \$config['database'] = \$config['database'][\$source]; + } + if (!empty(\$config['schema']) && is_array(\$config['schema'])) { + \$config['schema'] = \$config['schema'][\$source]; + } + \$this->{\$source} = \$config; + } + } + }" > app/Config/database.php + +script: + - sh -c "if [ '$PHPCS' = '1' ]; then phpcs -p --extensions=php --standard=CakePHP ./lib/Cake; elif [ '$DB' = 'mysql' ]; then ./lib/Cake/Console/cake test core AllTests --stderr; else ./lib/Cake/Console/cake test core AllDbRelated --stderr; fi" + +notifications: + email: false diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..0af4f7b --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,73 @@ +# How to contribute + +CakePHP loves to welcome your contributions. There are several ways to help out: +* Create an [issue](https://github.com/cakephp/cakephp/issues) on GitHub, if you have found a bug +* Write testcases for open bug issues +* Write patches for open bug/feature issues, preferably with testcases included +* Contribute to the [documentation](https://github.com/cakephp/docs) + +There are a few guidelines that we need contributors to follow so that we have a +chance of keeping on top of things. + +## Getting Started + +* Make sure you have a [GitHub account](https://github.com/signup/free). +* Submit an [issue](https://github.com/cakephp/cakephp/issues), assuming one does not already exist. + * Clearly describe the issue including steps to reproduce when it is a bug. + * Make sure you fill in the earliest version that you know has the issue. +* Fork the repository on GitHub. + +## Making Changes + +* Create a topic branch from where you want to base your work. + * This is usually the master branch. + * Only target release branches if you are certain your fix must be on that + branch. + * To quickly create a topic branch based on master; `git branch + master/my_contribution master` then checkout the new branch with `git + checkout master/my_contribution`. Better avoid working directly on the + `master` branch, to avoid conflicts if you pull in updates from origin. +* Make commits of logical units. +* Check for unnecessary whitespace with `git diff --check` before committing. +* Use descriptive commit messages and reference the #issue number. +* Core testcases should continue to pass. You can run tests locally or enable + [travis-ci](https://travis-ci.org/) for your fork, so all tests and codesniffs + will be executed. +* Your work should apply the CakePHP coding standards. + +## Which branch to base the work + +* Bugfix branches will be based on master. +* New features that are backwards compatible will be based on next minor release + branch. +* New features or other non-BC changes will go in the next major release branch. + +## Submitting Changes + +* Push your changes to a topic branch in your fork of the repository. +* Submit a pull request to the repository in the cakephp organization, with the + correct target branch. + +## Testcases and codesniffer + +CakePHP tests requires [PHPUnit](http://www.phpunit.de/manual/current/en/installation.html) +3.5 or higher. To run the testcases locally use the following command: + + ./lib/Cake/Console/cake test core AllTests --stderr + +To run the sniffs for CakePHP coding standards: + + phpcs -p --extensions=php --standard=CakePHP ./lib/Cake + +Check the [cakephp-codesniffer](https://github.com/cakephp/cakephp-codesniffer) +repository to setup the CakePHP standard. The README contains installation info +for the sniff and phpcs. + +# Additional Resources + +* [CakePHP coding standards](http://book.cakephp.org/2.0/en/contributing/cakephp-coding-conventions.html) +* [Existing issues](https://github.com/cakephp/cakephp/issues) +* [Development Roadmaps](https://github.com/cakephp/cakephp/wiki#roadmaps) +* [General GitHub documentation](https://help.github.com/) +* [GitHub pull request documentation](https://help.github.com/send-pull-requests/) +* #cakephp IRC channel on freenode.org diff --git a/README.md b/README.md new file mode 100644 index 0000000..343abce --- /dev/null +++ b/README.md @@ -0,0 +1,43 @@ +CakePHP +======= + +[![CakePHP](http://cakephp.org/img/cake-logo.png)](http://www.cakephp.org) + +CakePHP is a rapid development framework for PHP which uses commonly known design patterns like Active Record, Association Data Mapping, Front Controller and MVC. +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. + +Some Handy Links +---------------- + +[CakePHP](http://www.cakephp.org) - The rapid development PHP framework + +[CookBook](http://book.cakephp.org) - THE CakePHP user documentation; start learning here! + +[API](http://api.cakephp.org) - A reference to CakePHP's classes + +[Plugins](http://plugins.cakephp.org/) - A repository of extensions to the framework + +[The Bakery](http://bakery.cakephp.org) - Tips, tutorials and articles + +[Community Center](http://community.cakephp.org) - A source for everything community related + +[Training](http://training.cakephp.org) - Join a live session and get skilled with the framework + +[CakeFest](http://cakefest.org) - Don't miss our annual CakePHP conference + +[Cake Software Foundation](http://cakefoundation.org) - Promoting development related to CakePHP + +Get Support! +------------ + +[#cakephp](http://webchat.freenode.net/?channels=#cakephp) on irc.freenode.net - Come chat with us, we have cake + +[Google Group](https://groups.google.com/group/cake-php) - Community mailing list and forum + +[GitHub Issues](https://github.com/cakephp/cakephp/issues) - Got issues? Please tell us! + +[Roadmaps](https://github.com/cakephp/cakephp/wiki#roadmaps) - Want to contribute? Get involved! + +[![Bake Status](https://secure.travis-ci.org/cakephp/cakephp.png?branch=master)](http://travis-ci.org/cakephp/cakephp) + +![Cake Power](https://raw.github.com/cakephp/cakephp/master/lib/Cake/Console/Templates/skel/webroot/img/cake.power.gif) diff --git a/app/.htaccess b/app/.htaccess new file mode 100644 index 0000000..8cfc1ea --- /dev/null +++ b/app/.htaccess @@ -0,0 +1,5 @@ + + RewriteEngine on + RewriteRule ^$ webroot/ [L] + RewriteRule (.*) webroot/$1 [L] + diff --git a/app/Config/Schema/db_acl.php b/app/Config/Schema/db_acl.php new file mode 100644 index 0000000..495055b --- /dev/null +++ b/app/Config/Schema/db_acl.php @@ -0,0 +1,69 @@ + array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'), + 'parent_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10), + 'model' => array('type' => 'string', 'null' => true), + 'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10), + 'alias' => array('type' => 'string', 'null' => true), + 'lft' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10), + 'rght' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10), + 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)) + ); + + public $aros = array( + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'), + 'parent_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10), + 'model' => array('type' => 'string', 'null' => true), + 'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10), + 'alias' => array('type' => 'string', 'null' => true), + 'lft' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10), + 'rght' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10), + 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)) + ); + + public $aros_acos = array( + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'), + 'aro_id' => array('type' => 'integer', 'null' => false, 'length' => 10, 'key' => 'index'), + 'aco_id' => array('type' => 'integer', 'null' => false, 'length' => 10), + '_create' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2), + '_read' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2), + '_update' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2), + '_delete' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2), + 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'ARO_ACO_KEY' => array('column' => array('aro_id', 'aco_id'), 'unique' => 1)) + ); + +} diff --git a/app/Config/Schema/db_acl.sql b/app/Config/Schema/db_acl.sql new file mode 100644 index 0000000..274780e --- /dev/null +++ b/app/Config/Schema/db_acl.sql @@ -0,0 +1,41 @@ +# $Id$ +# +# Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) +# +# Licensed under The MIT License +# For full copyright and license information, please see the LICENSE.txt +# Redistributions of files must retain the above copyright notice. +# MIT License (http://www.opensource.org/licenses/mit-license.php) + +CREATE TABLE acos ( + id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, + parent_id INTEGER(10) DEFAULT NULL, + model VARCHAR(255) DEFAULT '', + foreign_key INTEGER(10) UNSIGNED DEFAULT NULL, + alias VARCHAR(255) DEFAULT '', + lft INTEGER(10) DEFAULT NULL, + rght INTEGER(10) DEFAULT NULL, + PRIMARY KEY (id) +); + +CREATE TABLE aros_acos ( + id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, + aro_id INTEGER(10) UNSIGNED NOT NULL, + aco_id INTEGER(10) UNSIGNED NOT NULL, + _create CHAR(2) NOT NULL DEFAULT 0, + _read CHAR(2) NOT NULL DEFAULT 0, + _update CHAR(2) NOT NULL DEFAULT 0, + _delete CHAR(2) NOT NULL DEFAULT 0, + PRIMARY KEY(id) +); + +CREATE TABLE aros ( + id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, + parent_id INTEGER(10) DEFAULT NULL, + model VARCHAR(255) DEFAULT '', + foreign_key INTEGER(10) UNSIGNED DEFAULT NULL, + alias VARCHAR(255) DEFAULT '', + lft INTEGER(10) DEFAULT NULL, + rght INTEGER(10) DEFAULT NULL, + PRIMARY KEY (id) +); \ No newline at end of file diff --git a/app/Config/Schema/i18n.php b/app/Config/Schema/i18n.php new file mode 100644 index 0000000..febb2db --- /dev/null +++ b/app/Config/Schema/i18n.php @@ -0,0 +1,50 @@ + array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'), + 'locale' => array('type' => 'string', 'null' => false, 'length' => 6, 'key' => 'index'), + 'model' => array('type' => 'string', 'null' => false, 'key' => 'index'), + 'foreign_key' => array('type' => 'integer', 'null' => false, 'length' => 10, 'key' => 'index'), + 'field' => array('type' => 'string', 'null' => false, 'key' => 'index'), + 'content' => array('type' => 'text', 'null' => true, 'default' => null), + '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)) + ); + +} diff --git a/app/Config/Schema/i18n.sql b/app/Config/Schema/i18n.sql new file mode 100644 index 0000000..66a42bd --- /dev/null +++ b/app/Config/Schema/i18n.sql @@ -0,0 +1,27 @@ +# $Id$ +# +# Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) +# +# Licensed under The MIT License +# For full copyright and license information, please see the LICENSE.txt +# Redistributions of files must retain the above copyright notice. +# MIT License (http://www.opensource.org/licenses/mit-license.php) + +CREATE TABLE i18n ( + id int(10) NOT NULL auto_increment, + locale varchar(6) NOT NULL, + model varchar(255) NOT NULL, + foreign_key int(10) NOT NULL, + field varchar(255) NOT NULL, + content mediumtext, + PRIMARY KEY (id), +# UNIQUE INDEX I18N_LOCALE_FIELD(locale, model, foreign_key, field), +# INDEX I18N_LOCALE_ROW(locale, model, foreign_key), +# INDEX I18N_LOCALE_MODEL(locale, model), +# INDEX I18N_FIELD(model, foreign_key, field), +# INDEX I18N_ROW(model, foreign_key), + INDEX locale (locale), + INDEX model (model), + INDEX row_id (foreign_key), + INDEX field (field) +); \ No newline at end of file diff --git a/app/Config/Schema/sessions.php b/app/Config/Schema/sessions.php new file mode 100644 index 0000000..14ff2c6 --- /dev/null +++ b/app/Config/Schema/sessions.php @@ -0,0 +1,45 @@ + array('type' => 'string', 'null' => false, 'key' => 'primary'), + 'data' => array('type' => 'text', 'null' => true, 'default' => null), + 'expires' => array('type' => 'integer', 'null' => true, 'default' => null), + 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)) + ); + +} diff --git a/app/Config/Schema/sessions.sql b/app/Config/Schema/sessions.sql new file mode 100644 index 0000000..76845bd --- /dev/null +++ b/app/Config/Schema/sessions.sql @@ -0,0 +1,17 @@ +# $Id$ +# +# Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) +# 1785 E. Sahara Avenue, Suite 490-204 +# Las Vegas, Nevada 89104 +# +# Licensed under The MIT License +# For full copyright and license information, please see the LICENSE.txt +# Redistributions of files must retain the above copyright notice. +# MIT License (http://www.opensource.org/licenses/mit-license.php) + +CREATE TABLE cake_sessions ( + id varchar(255) NOT NULL default '', + data text, + expires int(11) default NULL, + PRIMARY KEY (id) +); \ No newline at end of file diff --git a/app/Config/acl.ini.php b/app/Config/acl.ini.php new file mode 100644 index 0000000..9a46721 --- /dev/null +++ b/app/Config/acl.ini.php @@ -0,0 +1,65 @@ +; +;/** +; * ACL Configuration +; * +; * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) +; * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) +; * +; * Licensed under The MIT License +; * Redistributions of files must retain the above copyright notice. +; * +; * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) +; * @link http://cakephp.org CakePHP(tm) Project +; * @package app.Config +; * @since CakePHP(tm) v 0.10.0.1076 +; * @license http://www.opensource.org/licenses/mit-license.php MIT License +; */ + +; acl.ini.php - Cake ACL Configuration +; --------------------------------------------------------------------- +; Use this file to specify user permissions. +; aco = access control object (something in your application) +; aro = access request object (something requesting access) +; +; User records are added as follows: +; +; [uid] +; groups = group1, group2, group3 +; allow = aco1, aco2, aco3 +; deny = aco4, aco5, aco6 +; +; Group records are added in a similar manner: +; +; [gid] +; allow = aco1, aco2, aco3 +; deny = aco4, aco5, aco6 +; +; The allow, deny, and groups sections are all optional. +; NOTE: groups names *cannot* ever be the same as usernames! +; +; ACL permissions are checked in the following order: +; 1. Check for user denies (and DENY if specified) +; 2. Check for user allows (and ALLOW if specified) +; 3. Gather user's groups +; 4. Check group denies (and DENY if specified) +; 5. Check group allows (and ALLOW if specified) +; 6. If no aro, aco, or group information is found, DENY +; +; --------------------------------------------------------------------- + +;------------------------------------- +;Users +;------------------------------------- + +[username-goes-here] +groups = group1, group2 +deny = aco1, aco2 +allow = aco3, aco4 + +;------------------------------------- +;Groups +;------------------------------------- + +[groupname-goes-here] +deny = aco5, aco6 +allow = aco7, aco8 diff --git a/app/Config/acl.php b/app/Config/acl.php new file mode 100644 index 0000000..a8d6e38 --- /dev/null +++ b/app/Config/acl.php @@ -0,0 +1,133 @@ +Auth->authorize = array('Actions' => array('actionPath' => 'controllers/'),...) + * + * Now, when a user (i.e. jeff) authenticates successfully and requests a controller action (i.e. /invoices/delete) + * that is not allowed by default (e.g. via $this->Auth->allow('edit') in the Invoices controller) then AuthComponent + * will ask the configured ACL interface if access is granted. Under the assumptions 1. and 2. this will be + * done via a call to Acl->check() with + * + * array('User' => array('username' => 'jeff', 'group_id' => 4, ...)) + * + * as ARO and + * + * '/controllers/invoices/delete' + * + * as ACO. + * + * If the configured map looks like + * + * $config['map'] = array( + * 'User' => 'User/username', + * 'Role' => 'User/group_id', + * ); + * + * then PhpAcl will lookup if we defined a role like User/jeff. If that role is not found, PhpAcl will try to + * find a definition for Role/4. If the definition isn't found then a default role (Role/default) will be used to + * check rules for the given ACO. The search can be expanded by defining aliases in the alias configuration. + * E.g. if you want to use a more readable name than Role/4 in your definitions you can define an alias like + * + * $config['alias'] = array( + * 'Role/4' => 'Role/editor', + * ); + * + * In the roles configuration you can define roles on the lhs and inherited roles on the rhs: + * + * $config['roles'] = array( + * 'Role/admin' => null, + * 'Role/accountant' => null, + * 'Role/editor' => null, + * 'Role/manager' => 'Role/editor, Role/accountant', + * 'User/jeff' => 'Role/manager', + * ); + * + * In this example manager inherits all rules from editor and accountant. Role/admin doesn't inherit from any role. + * Lets define some rules: + * + * $config['rules'] = array( + * 'allow' => array( + * '*' => 'Role/admin', + * 'controllers/users/(dashboard|profile)' => 'Role/default', + * 'controllers/invoices/*' => 'Role/accountant', + * 'controllers/articles/*' => 'Role/editor', + * 'controllers/users/*' => 'Role/manager', + * 'controllers/invoices/delete' => 'Role/manager', + * ), + * 'deny' => array( + * 'controllers/invoices/delete' => 'Role/accountant, User/jeff', + * 'controllers/articles/(delete|publish)' => 'Role/editor', + * ), + * ); + * + * Ok, so as jeff inherits from Role/manager he's matched every rule that references User/jeff, Role/manager, + * Role/editor, Role/accountant and Role/default. However, for jeff, rules for User/jeff are more specific than + * rules for Role/manager, rules for Role/manager are more specific than rules for Role/editor and so on. + * This is important when allow and deny rules match for a role. E.g. Role/accountant is allowed + * controllers/invoices/* but at the same time controllers/invoices/delete is denied. But there is a more + * specific rule defined for Role/manager which is allowed controllers/invoices/delete. However, the most specific + * rule denies access to the delete action explicitly for User/jeff, so he'll be denied access to the resource. + * + * If we would remove the role definition for User/jeff, then jeff would be granted access as he would be resolved + * to Role/manager and Role/manager has an allow rule. + */ + +/** + * The role map defines how to resolve the user record from your application + * to the roles you defined in the roles configuration. + */ +$config['map'] = array( + 'User' => 'User/username', + 'Role' => 'User/group_id', +); + +/** + * define aliases to map your model information to + * the roles defined in your role configuration. + */ +$config['alias'] = array( + 'Role/4' => 'Role/editor', +); + +/** + * role configuration + */ +$config['roles'] = array( + 'Role/admin' => null, +); + +/** + * rule configuration + */ +$config['rules'] = array( + 'allow' => array( + '*' => 'Role/admin', + ), + 'deny' => array(), +); diff --git a/app/Config/bootstrap.php b/app/Config/bootstrap.php new file mode 100644 index 0000000..76994f8 --- /dev/null +++ b/app/Config/bootstrap.php @@ -0,0 +1,107 @@ + 'File')); + +/** + * The settings below can be used to set additional paths to models, views and controllers. + * + * App::build(array( + * 'Model' => array('/path/to/models/', '/next/path/to/models/'), + * 'Model/Behavior' => array('/path/to/behaviors/', '/next/path/to/behaviors/'), + * 'Model/Datasource' => array('/path/to/datasources/', '/next/path/to/datasources/'), + * 'Model/Datasource/Database' => array('/path/to/databases/', '/next/path/to/database/'), + * 'Model/Datasource/Session' => array('/path/to/sessions/', '/next/path/to/sessions/'), + * 'Controller' => array('/path/to/controllers/', '/next/path/to/controllers/'), + * 'Controller/Component' => array('/path/to/components/', '/next/path/to/components/'), + * 'Controller/Component/Auth' => array('/path/to/auths/', '/next/path/to/auths/'), + * 'Controller/Component/Acl' => array('/path/to/acls/', '/next/path/to/acls/'), + * 'View' => array('/path/to/views/', '/next/path/to/views/'), + * 'View/Helper' => array('/path/to/helpers/', '/next/path/to/helpers/'), + * 'Console' => array('/path/to/consoles/', '/next/path/to/consoles/'), + * 'Console/Command' => array('/path/to/commands/', '/next/path/to/commands/'), + * 'Console/Command/Task' => array('/path/to/tasks/', '/next/path/to/tasks/'), + * 'Lib' => array('/path/to/libs/', '/next/path/to/libs/'), + * 'Locale' => array('/path/to/locales/', '/next/path/to/locales/'), + * 'Vendor' => array('/path/to/vendors/', '/next/path/to/vendors/'), + * 'Plugin' => array('/path/to/plugins/', '/next/path/to/plugins/'), + * )); + * + */ + +/** + * Custom Inflector rules can be set to correctly pluralize or singularize table, model, controller names or whatever other + * string is passed to the inflection functions + * + * Inflector::rules('singular', array('rules' => array(), 'irregular' => array(), 'uninflected' => array())); + * Inflector::rules('plural', array('rules' => array(), 'irregular' => array(), 'uninflected' => array())); + * + */ + +/** + * Plugins need to be loaded manually, you can either load them one by one or all of them in a single call + * Uncomment one of the lines below, as you need. Make sure you read the documentation on CakePlugin to use more + * advanced ways of loading plugins + * + * CakePlugin::loadAll(); // Loads all plugins at once + * CakePlugin::load('DebugKit'); //Loads a single plugin named DebugKit + * + */ + +/** + * You can attach event listeners to the request lifecycle as Dispatcher Filter. By default CakePHP bundles two filters: + * + * - AssetDispatcher filter will serve your asset files (css, images, js, etc) from your themes and plugins + * - CacheDispatcher filter will read the Cache.check configure variable and try to serve cached content generated from controllers + * + * Feel free to remove or add filters as you see fit for your application. A few examples: + * + * Configure::write('Dispatcher.filters', array( + * 'MyCacheFilter', // will use MyCacheFilter class from the Routing/Filter package in your app. + * 'MyPlugin.MyFilter', // will use MyFilter class from the Routing/Filter package in MyPlugin plugin. + * array('callable' => $aFunction, 'on' => 'before', 'priority' => 9), // A valid PHP callback type to be called on beforeDispatch + * array('callable' => $anotherMethod, 'on' => 'after'), // A valid PHP callback type to be called on afterDispatch + * + * )); + */ +Configure::write('Dispatcher.filters', array( + 'AssetDispatcher', + 'CacheDispatcher' +)); + +/** + * Configures default file logging options + */ +App::uses('CakeLog', 'Log'); +CakeLog::config('debug', array( + 'engine' => 'File', + 'types' => array('notice', 'info', 'debug'), + 'file' => 'debug', +)); +CakeLog::config('error', array( + 'engine' => 'File', + 'types' => array('warning', 'error', 'critical', 'alert', 'emergency'), + 'file' => 'error', +)); diff --git a/app/Config/database.php.default b/app/Config/database.php.default new file mode 100644 index 0000000..42fedb6 --- /dev/null +++ b/app/Config/database.php.default @@ -0,0 +1,85 @@ + The name of a supported datasource; valid options are as follows: + * Database/Mysql - MySQL 4 & 5, + * Database/Sqlite - SQLite (PHP5 only), + * Database/Postgres - PostgreSQL 7 and higher, + * Database/Sqlserver - Microsoft SQL Server 2005 and higher + * + * You can add custom database datasources (or override existing datasources) by adding the + * appropriate file to app/Model/Datasource/Database. Datasources should be named 'MyDatasource.php', + * + * + * persistent => true / false + * Determines whether or not the database should use a persistent connection + * + * host => + * the host you connect to the database. To add a socket or port number, use 'port' => # + * + * prefix => + * Uses the given prefix for all the tables in this database. This setting can be overridden + * on a per-table basis with the Model::$tablePrefix property. + * + * schema => + * For Postgres/Sqlserver specifies which schema you would like to use the tables in. + * Postgres defaults to 'public'. For Sqlserver, it defaults to empty and use + * the connected user's default schema (typically 'dbo'). + * + * encoding => + * 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` + * + * settings => + * Array of key/value pairs, on connection it executes SET statements for each pair + * For MySQL : http://dev.mysql.com/doc/refman/5.6/en/set-statement.html + * For Postgres : http://www.postgresql.org/docs/9.2/static/sql-set.html + * For Sql Server : http://msdn.microsoft.com/en-us/library/ms190356.aspx + */ +class DATABASE_CONFIG { + + public $default = array( + 'datasource' => 'Database/Mysql', + 'persistent' => false, + 'host' => 'localhost', + 'login' => 'user', + 'password' => 'password', + 'database' => 'database_name', + 'prefix' => '', + //'encoding' => 'utf8', + ); + + public $test = array( + 'datasource' => 'Database/Mysql', + 'persistent' => false, + 'host' => 'localhost', + 'login' => 'user', + 'password' => 'password', + 'database' => 'test_database_name', + 'prefix' => '', + //'encoding' => 'utf8', + ); +} diff --git a/app/Config/email.php.default b/app/Config/email.php.default new file mode 100644 index 0000000..cee93c3 --- /dev/null +++ b/app/Config/email.php.default @@ -0,0 +1,94 @@ + 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', + * where 'Your' is the name of the transport. + * + * from => + * The origin email. See CakeEmail::from() about the valid values + * + */ +class EmailConfig { + + public $default = array( + 'transport' => 'Mail', + 'from' => 'you@localhost', + //'charset' => 'utf-8', + //'headerCharset' => 'utf-8', + ); + + public $smtp = array( + 'transport' => 'Smtp', + 'from' => array('site@localhost' => 'My Site'), + 'host' => 'localhost', + 'port' => 25, + 'timeout' => 30, + 'username' => 'user', + 'password' => 'secret', + 'client' => null, + 'log' => false, + //'charset' => 'utf-8', + //'headerCharset' => 'utf-8', + ); + + public $fast = array( + 'from' => 'you@localhost', + 'sender' => null, + 'to' => null, + 'cc' => null, + 'bcc' => null, + 'replyTo' => null, + 'readReceipt' => null, + 'returnPath' => null, + 'messageId' => true, + 'subject' => null, + 'message' => null, + 'headers' => null, + 'viewRender' => null, + 'template' => false, + 'layout' => false, + 'viewVars' => null, + 'attachments' => null, + 'emailFormat' => null, + 'transport' => 'Smtp', + 'host' => 'localhost', + 'port' => 25, + 'timeout' => 30, + 'username' => 'user', + 'password' => 'secret', + 'client' => null, + 'log' => true, + //'charset' => 'utf-8', + //'headerCharset' => 'utf-8', + ); + +} diff --git a/app/Config/routes.php b/app/Config/routes.php new file mode 100644 index 0000000..9fd8bd9 --- /dev/null +++ b/app/Config/routes.php @@ -0,0 +1,125 @@ + 'home', 'action' => 'home')); + Router::connect('/login', array('controller' => 'home', 'action' => 'login')); + Router::connect('/logout', array('controller' => 'home', 'action' => 'logout')); + Router::connect('/impressum', array('controller' => 'home', 'action' => 'impressum')); + Router::connect('/agb', array('controller' => 'home', 'action' => 'agb')); + + Router::connect('/contact', array('controller' => 'extra', 'action' => 'contact')); + Router::connect('/cooperators', array('controller' => 'extra', 'action' => 'cooperators')); + Router::connect('/team', array('controller' => 'extra', 'action' => 'team')); + Router::connect('/premium', array('controller' => 'extra', 'action' => 'premium')); + Router::connect('/advertise', array('controller' => 'extra', 'action' => 'advertise')); + Router::connect('/adv/company', array('controller' => 'extra', 'action' => 'company')); + Router::connect('/adv/worker', array('controller' => 'extra', 'action' => 'worker')); + + Router::connect('/plus', array('controller' => 'service', 'action' => 'index')); + Router::connect('/plus/:list', array('controller' => 'service','action'=>'index'),array("list"=>"[a-z0-9]+")); + Router::connect('/plus/show/:item', array('controller' => 'service','action'=>'show'),array("item"=>"[a-z0-9]+")); + Router::connect('/plus/:list/:item', array('controller' => 'service','action'=>'show'),array("list"=>"[a-z0-9]+","item"=>"[a-z0-9]+")); + + Router::connect('/company', array('controller' => 'home', 'action' => 'company')); + + Router::connect('/company/registration', array('controller' => 'registration', 'action' => 'company')); + + Router::connect('/registration', array('controller' => 'registration', 'action' => 'worker')); + Router::connect('/registration/active/:code', array('controller' => 'registration', 'action' => 'active'),array("code" => ".+")); + + Router::connect('/password/reset', array('controller' => 'registration', 'action' => 'password_reset')); + Router::connect('/password/replace/:code', array('controller' => 'registration', 'action' => 'password_replace'),array("code" => ".+")); + + Router::connect('/profil', array('controller' => 'user', 'action' => 'profil')); + Router::connect('/profil/page/:page', array('controller' => 'user', 'action' => 'profil'),array("page" => "[0-9]+")); + Router::connect('/profil/edit', array('controller' => 'user', 'action' => 'profil_edit')); + Router::connect('/settings', array('controller' => 'user', 'action' => 'settings_account')); + Router::connect('/settings/pages', array('controller' => 'user', 'action' => 'settings_pageInh')); + Router::connect('/settings/pages/:page', array('controller' => 'user', 'action' => 'settings_pageInh'),array("page" => "[0-9]+")); + Router::connect('/settings/isearch', array('controller' => 'user', 'action' => 'settings_isearch')); + Router::connect('/settings/delete', array('controller' => 'user', 'action' => 'profil_delete')); + Router::connect('/settings/img', array('controller' => 'user', 'action' => 'avatar_upload')); + + + + Router::connect('/user/:id', array('controller' => 'user', 'action' => 'profil'),array("id" => "[0-9]+")); + Router::connect('/user/:id/page/:page', array('controller' => 'user', 'action' => 'profil'),array("id" => "[0-9]+","page" => "[0-9]+")); + + Router::connect('/opening', array('controller' => 'job', 'action' => 'openingList')); + Router::connect('/opening/add', array('controller' => 'job', 'action' => 'openingAdd')); + Router::connect('/opening/edit/:id', array('controller' => 'job', 'action' => 'openingEdit'),array("id" => "[0-9]+")); + Router::connect('/opening/:id', array('controller' => 'job', 'action' => 'openingGet'),array("id" => "[0-9]+")); + Router::connect('/opening/:id/application', array('controller' => 'job', 'action' => 'applicationByOpening'),array("id" => "[0-9]+")); + Router::connect('/opening/:id/:extra', array('controller' => 'job', 'action' => 'openingGet'), array("id" => "[0-9]+")); + + Router::connect('/application', array('controller' => 'job', 'action' => 'applicationList')); + Router::connect('/application/:id', array('controller' => 'job', 'action' => 'applicationGet'),array("id" => "[0-9]+")); + + Router::connect('/application/:id/page/:page', array('controller' => 'job', 'action' => 'applicationGet'),array("id" => "[0-9]+","page" => "[0-9]+")); + Router::connect('/application/:id/curriculum:vitea', array('controller' => 'job', 'action' => 'applicationGet'), array("id" => "[0-9]+",'vitea' => '(?i:vitea)')); + Router::connect('/application/:id/mess:ages', array('controller' => 'job', 'action' => 'applicationGet'), array("id" => "[0-9]+",'ages' => '(?i:ages)')); + Router::connect('/application/:id/arc:hiv', array('controller' => 'job', 'action' => 'applicationGet'), array("id" => "[0-9]+",'hiv' => '(?i:hiv)')); + + Router::connect('/applicate/:id', array('controller' => 'job', 'action' => 'applicationSend'),array("id" => "[0-9]+")); + Router::connect('/applicate/extern', array('controller' => 'job', 'action' => 'applicationSendExt')); + Router::connect('/applicate/extern/info', array('controller' => 'job', 'action' => 'applicationSendExtInfo')); + + Router::connect('/favorite', array('controller' => 'job', 'action' => 'favorite')); + + //Router::connect('/search', array('controller' => 'search', 'action' => 'listopening')); + Router::connect('/search', array('controller' => 'search', 'action' => 'opening')); + Router::connect('/search/company', array('controller' => 'search', 'action' => 'company')); + Router::connect('/search/worker', array('controller' => 'search', 'action' => 'worker')); + Router::connect('/search/auto', array('controller' => 'search', 'action' => 'auto')); + Router::connect('/search/education', array('controller' => 'search', 'action' => 'education')); + Router::connect('/search/academy', array('controller' => 'search', 'action' => 'academy')); + Router::connect('/search/internship', array('controller' => 'search', 'action' => 'internship')); + + + Router::parseExtensions('pdf'); + Router::connect('/application/:id.pdf', array('controller' => 'pdf', 'action' => 'applicationGetPdf'),array("id" => "[0-9]+")); + Router::connect('/profil.pdf', array('controller' => 'pdf', 'action' => 'profilGetPdf')); + + Router::parseExtensions('json'); + Router::connect('/profil/save/cv', array('controller' => 'user', 'action' => 'saveCvJson')); + Router::connect('/settings/pages/delete', array('controller' => 'user', 'action' => 'savePageDeleteJson')); + Router::connect('/settings/pages/order', array('controller' => 'user', 'action' => 'savePageOrder')); +/** + * ...and connect the rest of 'Pages' controller's URLs. + */ +//Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display')); + +/** + * Load all plugin routes. See the CakePlugin documentation on + * how to customize the loading of plugin routes. + */ +// CakePlugin::routes(); + +/** + * Load the CakePHP default routes. Only remove this if you do not want to use + * the built-in default routes. + */ +// require CAKE . 'Config' . DS . 'routes.php'; diff --git a/app/Console/Command/AppShell.php b/app/Console/Command/AppShell.php new file mode 100644 index 0000000..4ea0f2d --- /dev/null +++ b/app/Console/Command/AppShell.php @@ -0,0 +1,30 @@ +