-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
421 changed files
with
74,165 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[submodule "libraries/lithium"] | ||
path = libraries/lithium | ||
url = git://github.com/UnionOfRAD/lithium.git | ||
[submodule "libraries/li3_flash_message"] | ||
path = libraries/li3_flash_message | ||
url = git://github.com/michaelhue/li3_flash_message.git | ||
[submodule "libraries/li3_paginate"] | ||
path = libraries/li3_paginate | ||
url = git://github.com/primetheus/li3_paginate.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
echo "" | ||
echo "Getting all necessary submodules..." | ||
git submodule update --init | ||
echo "" | ||
|
||
echo "" | ||
echo "Installation complete." | ||
echo "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?php | ||
/** | ||
* Lithium: the most rad php framework | ||
* | ||
* @copyright Copyright 2011, Union of RAD (http://union-of-rad.org) | ||
* @license http://opensource.org/licenses/bsd-license.php The BSD License | ||
*/ | ||
|
||
/** | ||
* This is the primary bootstrap file of your application, and is loaded immediately after the front | ||
* controller (`webroot/index.php`) is invoked. It includes references to other feature-specific | ||
* bootstrap files that you can turn on and off to configure the services needed for your | ||
* application. | ||
* | ||
* Besides global configuration of external application resources, these files also include | ||
* configuration for various classes to interact with one another, usually through _filters_. | ||
* Filters are Lithium's system of creating interactions between classes without tight coupling. See | ||
* the `Filters` class for more information. | ||
* | ||
* If you have other services that must be configured globally for the entire application, create a | ||
* new bootstrap file and `require` it here. | ||
* | ||
* @see lithium\util\collection\Filters | ||
*/ | ||
|
||
/** | ||
* The libraries file contains the loading instructions for all plugins, frameworks and other class | ||
* libraries used in the application, including the Lithium core, and the application itself. These | ||
* instructions include library names, paths to files, and any applicable class-loading rules. This | ||
* file also statically loads common classes to improve bootstrap performance. | ||
*/ | ||
require __DIR__ . '/bootstrap/libraries.php'; | ||
|
||
/** | ||
* The error configuration allows you to use the filter system along with the advanced matching | ||
* rules of the `ErrorHandler` class to provide a high level of control over managing exceptions in | ||
* your application, with no impact on framework or application code. | ||
*/ | ||
require __DIR__ . '/bootstrap/errors.php'; | ||
|
||
/** | ||
* This file contains configurations for connecting to external caching resources, as well as | ||
* default caching rules for various systems within your application | ||
*/ | ||
require __DIR__ . '/bootstrap/cache.php'; | ||
|
||
/** | ||
* Include this file if your application uses one or more database connections. | ||
*/ | ||
// require __DIR__ . '/bootstrap/connections.php'; | ||
|
||
/** | ||
* This file defines bindings between classes which are triggered during the request cycle, and | ||
* allow the framework to automatically configure its environmental settings. You can add your own | ||
* behavior and modify the dispatch cycle to suit your needs. | ||
*/ | ||
require __DIR__ . '/bootstrap/action.php'; | ||
|
||
/** | ||
* This file contains configuration for session (and/or cookie) storage, and user or web service | ||
* authentication. | ||
*/ | ||
require __DIR__ . '/bootstrap/session.php'; | ||
|
||
/** | ||
* This file contains your application's globalization rules, including inflections, | ||
* transliterations, localized validation, and how localized text should be loaded. Uncomment this | ||
* line if you plan to globalize your site. | ||
*/ | ||
// require __DIR__ . '/bootstrap/g11n.php'; | ||
|
||
/** | ||
* This file contains configurations for handling different content types within the framework, | ||
* including converting data to and from different formats, and handling static media assets. | ||
*/ | ||
require __DIR__ . '/bootstrap/media.php'; | ||
|
||
/** | ||
* This file configures console filters and settings, specifically output behavior and coloring. | ||
*/ | ||
// require __DIR__ . '/bootstrap/console.php'; | ||
|
||
/** | ||
* This file contains confiuration for logging. | ||
* Log files will be written to /resources/tmp/logs | ||
*/ | ||
require __DIR__ . '/bootstrap/logging.php'; | ||
|
||
/** | ||
* Sets up additional menus and/or modifies default menus. | ||
* Feel free to use this file if you like for your own application. | ||
*/ | ||
// require __DIR__ . '/bootstrap/menu.php'; | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
/** | ||
* Lithium: the most rad php framework | ||
* | ||
* @copyright Copyright 2011, Union of RAD (http://union-of-rad.org) | ||
* @license http://opensource.org/licenses/bsd-license.php The BSD License | ||
*/ | ||
|
||
/** | ||
* This file contains a series of method filters that allow you to intercept different parts of | ||
* Lithium's dispatch cycle. The filters below are used for on-demand loading of routing | ||
* configuration, and automatically configuring the correct environment in which the application | ||
* runs. | ||
* | ||
* For more information on in the filters system, see `lithium\util\collection\Filters`. | ||
* | ||
* @see lithium\util\collection\Filters | ||
*/ | ||
|
||
use lithium\core\Libraries; | ||
use lithium\net\http\Router; | ||
use lithium\core\Environment; | ||
use lithium\action\Dispatcher; | ||
|
||
/** | ||
* This filter intercepts the `run()` method of the `Dispatcher`, and first passes the `'request'` | ||
* parameter (an instance of the `Request` object) to the `Environment` class to detect which | ||
* environment the application is running in. Then, loads all application routes in all plugins, | ||
* loading the default application routes last. | ||
* | ||
* Change this code if plugin routes must be loaded in a specific order (i.e. not the same order as | ||
* the plugins are added in your bootstrap configuration), or if application routes must be loaded | ||
* first (in which case the default catch-all routes should be removed). | ||
* | ||
* If `Dispatcher::run()` is called multiple times in the course of a single request, change the | ||
* `include`s to `include_once`. | ||
* | ||
* @see lithium\action\Request | ||
* @see lithium\core\Environment | ||
* @see lithium\net\http\Router | ||
*/ | ||
Dispatcher::applyFilter('run', function($self, $params, $chain) { | ||
Environment::set($params['request']); | ||
|
||
foreach (array_reverse(Libraries::get()) as $name => $config) { | ||
if ($name === 'lithium') { | ||
continue; | ||
} | ||
$file = "{$config['path']}/config/routes.php"; | ||
file_exists($file) ? include $file : null; | ||
} | ||
return $chain->next($self, $params, $chain); | ||
}); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
/** | ||
* Lithium: the most rad php framework | ||
* | ||
* @copyright Copyright 2011, Union of RAD (http://union-of-rad.org) | ||
* @license http://opensource.org/licenses/bsd-license.php The BSD License | ||
*/ | ||
|
||
/** | ||
* This file creates a default cache configuration using the most optimized adapter available, and | ||
* uses it to provide default caching for high-overhead operations. | ||
*/ | ||
use lithium\storage\Cache; | ||
use lithium\core\Libraries; | ||
use lithium\action\Dispatcher; | ||
use lithium\storage\cache\adapter\Apc; | ||
|
||
if (PHP_SAPI === 'cli') { | ||
return; | ||
} | ||
|
||
/** | ||
* If APC is not available and the cache directory is not writeable, bail out. This block should be | ||
* removed post-install, and the cache should be configured with the adapter you plan to use. | ||
*/ | ||
$cachePath = Libraries::get(true, 'resources') . '/tmp/cache'; | ||
|
||
if (!($apcEnabled = Apc::enabled()) && !is_writable($cachePath)) { | ||
return; | ||
} | ||
|
||
/** | ||
* This configures the default cache, based on whether ot not APC user caching is enabled. If it is | ||
* not, file caching will be used. Most of this code is for getting you up and running only, and | ||
* should be replaced with a hard-coded configuration, based on the cache(s) you plan to use. | ||
*/ | ||
$default = array('adapter' => 'File', 'strategies' => array('Serializer')); | ||
|
||
if ($apcEnabled) { | ||
$default = array('adapter' => 'Apc'); | ||
} | ||
Cache::config(compact('default')); | ||
|
||
/** | ||
* Caches paths for auto-loaded and service-located classes. | ||
*/ | ||
Dispatcher::applyFilter('run', function($self, $params, $chain) { | ||
$key = md5(LITHIUM_APP_PATH) . '.core.libraries'; | ||
|
||
if ($cache = Cache::read('default', $key)) { | ||
$cache = (array) $cache + Libraries::cache(); | ||
Libraries::cache($cache); | ||
} | ||
$result = $chain->next($self, $params, $chain); | ||
|
||
if ($cache != Libraries::cache()) { | ||
Cache::write('default', $key, Libraries::cache(), '+1 day'); | ||
} | ||
return $result; | ||
}); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
/** | ||
* Lithium: the most rad php framework | ||
* | ||
* @copyright Copyright 2011, Union of RAD (http://union-of-rad.org) | ||
* @license http://opensource.org/licenses/bsd-license.php The BSD License | ||
*/ | ||
|
||
/** | ||
* ### Configuring backend database connections | ||
* | ||
* Lithium supports a wide variety relational and non-relational databases, and is designed to allow | ||
* and encourage you to take advantage of multiple database technologies, choosing the most optimal | ||
* one for each task. | ||
* | ||
* As with other `Adaptable`-based configurations, each database configuration is defined by a name, | ||
* and an array of information detailing what database adapter to use, and how to connect to the | ||
* database server. Unlike when configuring other classes, `Connections` uses two keys to determine | ||
* which class to select. First is the `'type'` key, which specifies the type of backend to | ||
* connect to. For relational databases, the type is set to `'database'`. For HTTP-based backends, | ||
* like CouchDB, the type is `'http'`. Some backends have no type grouping, like MongoDB, which is | ||
* unique and connects via a custom PECL extension. In this case, the type is set to `'MongoDb'`, | ||
* and no `'adapter'` key is specified. In other cases, the `'adapter'` key identifies the unique | ||
* adapter of the given type, i.e. `'MySql'` for the `'database'` type, or `'CouchDb'` for the | ||
* `'http'` type. Note that while adapters are always specified in CamelCase form, types are | ||
* specified either in CamelCase form, or in underscored form, depending on whether an `'adapter'` | ||
* key is specified. See the examples below for more details. | ||
* | ||
* ### Multiple environments | ||
* | ||
* As with other `Adaptable` classes, `Connections` supports optionally specifying different | ||
* configurations per named connection, depending on the current environment. For information on | ||
* specifying environment-based configurations, see the `Environment` class. | ||
* | ||
* @see lithium\core\Adaptable | ||
* @see lithium\core\Environment | ||
*/ | ||
use lithium\data\Connections; | ||
|
||
/** | ||
* Uncomment this configuration to use MongoDB as your default database. | ||
*/ | ||
// Connections::add('default', array( | ||
// 'type' => 'MongoDb', | ||
// 'host' => 'localhost', | ||
// 'database' => 'my_app' | ||
// )); | ||
|
||
/** | ||
* Uncomment this configuration to use CouchDB as your default database. | ||
*/ | ||
// Connections::add('default', array( | ||
// 'type' => 'http', | ||
// 'adapter' => 'CouchDb', | ||
// 'host' => 'localhost', | ||
// 'database' => 'my_app' | ||
// )); | ||
|
||
/** | ||
* Uncomment this configuration to use MySQL as your default database. | ||
*/ | ||
// Connections::add('default', array( | ||
// 'type' => 'database', | ||
// 'adapter' => 'MySql', | ||
// 'host' => 'localhost', | ||
// 'login' => 'root', | ||
// 'password' => '', | ||
// 'database' => 'my_app', | ||
// 'encoding' => 'UTF-8' | ||
// )); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
/** | ||
* Lithium: the most rad php framework | ||
* | ||
* @copyright Copyright 2011, Union of RAD (http://union-of-rad.org) | ||
* @license http://opensource.org/licenses/bsd-license.php The BSD License | ||
*/ | ||
|
||
use lithium\console\Dispatcher; | ||
|
||
Dispatcher::applyFilter('_call', function($self, $params, $chain) { | ||
$params['callable']->response->styles(array( | ||
'heading' => '\033[1;30;46m' | ||
)); | ||
return $chain->next($self, $params, $chain); | ||
}); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
/** | ||
* Lithium: the most rad php framework | ||
* | ||
* @copyright Copyright 2011, Union of RAD (http://union-of-rad.org) | ||
* @license http://opensource.org/licenses/bsd-license.php The BSD License | ||
*/ | ||
|
||
use lithium\core\ErrorHandler; | ||
use lithium\action\Response; | ||
use lithium\net\http\Media; | ||
use lithium\core\Environment; | ||
|
||
ErrorHandler::apply('lithium\action\Dispatcher::run', array(), function($info, $params) { | ||
$response = new Response(array( | ||
'request' => $params['request'], | ||
'status' => $info['exception']->getCode() | ||
)); | ||
|
||
// Production error templates should follow the design of the site. | ||
$error_layout = 'default'; | ||
$error_template = 'production'; | ||
|
||
// Development error templates can look different. | ||
if(Environment::is('development')) { | ||
$error_template = 'development'; | ||
$error_layout = 'error'; | ||
} | ||
|
||
Media::render($response, compact('info', 'params'), array( | ||
'controller' => '_errors', | ||
'template' => $error_template, | ||
'layout' => $error_layout, | ||
'request' => $params['request'] | ||
)); | ||
return $response; | ||
}); | ||
?> |
Oops, something went wrong.