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
0 parents
commit b672560
Showing
463 changed files
with
80,479 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,5 @@ | ||
<IfModule mod_rewrite.c> | ||
RewriteEngine on | ||
RewriteRule ^$ webroot/ [L] | ||
RewriteRule (.*) webroot/$1 [L] | ||
</IfModule> |
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,31 @@ | ||
<?php | ||
/** | ||
* Add your application-wide methods in the class below, your controllers | ||
* will inherit them. | ||
* | ||
* @package cake | ||
* @subpackage cake.app | ||
*/ | ||
class AppController extends Controller { | ||
var $components = array( | ||
'Authsome.Authsome' => array('model' => 'User'), | ||
'DebugKit.Toolbar', | ||
'Mail', | ||
'RequestHandler', | ||
'Sanction.Permit', | ||
'Session', | ||
'Settings.Settings', | ||
); | ||
var $helpers = array( | ||
'Form', 'Html', 'Js', 'Resource', 'Sanction.Clearance', | ||
'Session', 'Time', 'Wysiwyg.Tinymce', 'UploadPack.Upload' | ||
); | ||
|
||
function beforeFilter() { | ||
if (in_array($this->RequestHandler->ext, array('json', 'xml'))) { | ||
$this->view = 'WebService'; | ||
$this->set('baseRoute', Router::url('/', true)); | ||
} | ||
} | ||
} | ||
?> |
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,51 @@ | ||
<?php | ||
class AppError extends ErrorHandler { | ||
|
||
function __construct($method, $messages) { | ||
App::import('Core', 'Sanitize'); | ||
static $__previousError = null; | ||
|
||
if ($__previousError != array($method, $messages)) { | ||
$__previousError = array($method, $messages); | ||
$this->controller =& new CakeErrorController(); | ||
} else { | ||
$this->controller =& new Controller(); | ||
$this->controller->viewPath = 'errors'; | ||
} | ||
|
||
$options = array('escape' => false); | ||
$messages = Sanitize::clean($messages, $options); | ||
|
||
if (!isset($messages[0])) { | ||
$messages = array($messages); | ||
} | ||
|
||
if (method_exists($this->controller, 'apperror')) { | ||
return $this->controller->appError($method, $messages); | ||
} | ||
|
||
if (!in_array(strtolower($method), array_map('strtolower', get_class_methods($this)))) { | ||
$method = 'error'; | ||
} | ||
|
||
$this->dispatchMethod($method, $messages); | ||
$this->_stop(); | ||
} | ||
|
||
function missingController($params) { | ||
$this->lost(); | ||
} | ||
|
||
function missingAction($params) { | ||
$this->lost(); | ||
} | ||
|
||
function missingView($params) { | ||
$this->lost(); | ||
} | ||
|
||
function lost() { | ||
$this->controller->redirect(array('plugin' => null, 'controller' => 'lost', 'action' => 'index', $this->controller->params['url']['url'])); | ||
} | ||
} | ||
?> |
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,25 @@ | ||
<?php | ||
/** | ||
* Add your application-wide methods in the class below, your helpers | ||
* will inherit them. | ||
* | ||
* @package cake | ||
* @subpackage cake.cake | ||
*/ | ||
class AppHelper extends Helper { | ||
var $view = null; | ||
|
||
function h2($contents, $alternate = null) { | ||
ob_start(); | ||
if ((empty($contents) || $contents == '' || $contents == ' ') && isset($alternate)) { | ||
$contents = $alternate; | ||
} | ||
if (!$this->view) { | ||
$this->view = ClassRegistry::getObject('view'); | ||
} | ||
echo "<h2>{$contents}</h2>"; | ||
$this->view->set('title_for_layout', "{$contents} |"); | ||
$this->view->set("h2_for_layout", ob_get_clean()); | ||
} | ||
} | ||
?> |
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,196 @@ | ||
<?php | ||
class AppModel extends Model { | ||
var $actsAs = array('Callbackable', 'Containable', 'Lookupable'); | ||
var $recursive = -1; | ||
var $behaviorData = null; | ||
var $query = null; | ||
|
||
/** | ||
* Custom find types, as per Matt Curry's method | ||
* | ||
* @param string $type | ||
* @param array $options | ||
* @return mixed array|integer|boolean | ||
* @author Matt Curry | ||
* @link http://github.com/mcurry/find | ||
*/ | ||
function find($type, $options = array()) { | ||
$method = null; | ||
if(is_string($type)) { | ||
$method = sprintf('__find%s', Inflector::camelize($type)); | ||
} | ||
if($method && method_exists($this, $method)) { | ||
$return = $this->{$method}($options); | ||
if ($this->query != null) { | ||
unset($this->query['paginate']); | ||
$query = $this->query; | ||
$this->query = null; | ||
return $query; | ||
} | ||
return $return; | ||
} | ||
if (is_array($options) && isset($options['cache']) && !empty($options['cache'])) { | ||
App::import('Vendor', 'mi_cache'); | ||
if (is_int($options['cache'])) MiCache::config(array('duration' => $options['cache'])); | ||
unset($options['cache']); | ||
return MiCache::data($this->alias, 'find', $type, $options); | ||
} | ||
if (!in_array($type, array_keys($this->_findMethods))) { | ||
diebug(array($type, $options)); | ||
$calledFrom = debug_backtrace(); | ||
CakeLog::write('error', "Unknown method {$this->alias}->{$method} in " . substr(str_replace(ROOT, '', $calledFrom[0]['file']), 1) . ' on line ' . $calledFrom[0]['line'] ); | ||
return false; | ||
} | ||
$args = func_get_args(); | ||
return call_user_func_array(array('parent', 'find'), $args); | ||
} | ||
|
||
/** | ||
* Allows the returning of query parameters for use in pagination | ||
* | ||
* @param array $query | ||
* @return boolean | ||
* @author Matt Curry | ||
*/ | ||
function beforeFind($query) { | ||
if (is_array($query) && isset($query['paginate']) && !empty($query['paginate'])) { | ||
$keys = array('fields', 'order', 'limit', 'page'); | ||
foreach($keys as $key) { | ||
if($query[$key] === null || (is_array($query[$key]) && $query[$key][0] === null) ) { | ||
unset($query[$key]); | ||
} | ||
} | ||
$this->query = $query; | ||
return false; | ||
} | ||
$this->query = null; | ||
return true; | ||
} | ||
|
||
/** | ||
* undocumented function | ||
* | ||
* @param array $data Data to save. | ||
* @param mixed $validate Either a boolean, or an array. | ||
* If a boolean, indicates whether or not to validate before saving. | ||
* If an array, allows control of validate, callbacks, and fieldList | ||
* @param array $fieldList List of fields to allow to be written | ||
* @param array $extra controls access to optional data a Behavior may want | ||
* @return mixed On success Model::$data if its not empty or true, false on failure | ||
* @access public | ||
* @author Jose Diaz-Gonzalez | ||
**/ | ||
function save($data = null, $validate = true, $fieldList = array(), $extra = array()) { | ||
$this->data = (!$data) ? $this->data : $data; | ||
if (!$this->data) return false; | ||
|
||
$options = array('validate' => true, 'fieldList' => array(), 'callbacks' => true); | ||
if (is_array($validate)) { | ||
$options = array_merge($options, $validate); | ||
foreach($options as $key => &$value) { | ||
if (!in_array($key, array('validate', 'fieldList', 'callbacks'))) { | ||
$extra[$key] = $value; | ||
} | ||
} | ||
} else { | ||
$options = array_merge($options, compact('validate', 'fieldList', 'callbacks')); | ||
} | ||
|
||
$this->behaviorData = $extra; | ||
|
||
$method = null; | ||
if (isset($extra['callback']) and is_string($extra['callback'])) { | ||
$method = sprintf('__beforeSave%s', Inflector::camelize($extra['callback'])); | ||
} | ||
|
||
if($method && method_exists($this, $method)) { | ||
$this->data = $this->{$method}($this->data, $extra); | ||
} | ||
if (!$this->data) return false; | ||
return parent::save($this->data, $options); | ||
} | ||
|
||
/** | ||
* Unsets contain key for faster pagination counts | ||
* | ||
* @param array $conditions | ||
* @param integer $recursive | ||
* @param array $extra | ||
* @return integer | ||
* @author Jose Diaz-Gonzalez | ||
*/ | ||
function paginateCount($conditions = null, $recursive = 0, $extra = array()) { | ||
$conditions = compact('conditions'); | ||
if ($recursive != $this->recursive) { | ||
$conditions['recursive'] = $recursive; | ||
} | ||
$extra['contain'] = false; | ||
return $this->find('count', array_merge($conditions, $extra)); | ||
} | ||
|
||
/** | ||
* Updates a particular record without invoking model callbacks | ||
* | ||
* @return boolean True on success, false on Model::id is not set or failure | ||
* @author Jose Diaz-Gonzalez | ||
**/ | ||
function update($fields, $conditions = array()) { | ||
if (!$this->id) return false; | ||
|
||
$conditions = array_merge(array("{$this->alias}.$this->primaryKey" => $this->id), $conditions); | ||
|
||
return $this->updateAll($fields, $conditions); | ||
} | ||
|
||
/** | ||
* Disables/detaches all behaviors from model | ||
* | ||
* @param mixed $except string or array of behaviors to exclude from detachment | ||
* @param boolean $detach If true, detaches the behavior instead of disabling it | ||
* @return void | ||
* @author Jose Diaz-Gonzalez | ||
*/ | ||
function detachAllBehaviors($except = array(), $detach = false) { | ||
if ($except and !is_array($except)) { | ||
$except = array($except); | ||
} | ||
$behaviors = $this->Behaviors->attached(); | ||
foreach ($behaviors as &$behavior) { | ||
if (!in_array($behavior, $except)) { | ||
if (!$detach) { | ||
$this->Behaviors->disable($behavior); | ||
} else { | ||
$this->Behaviors->detach($behavior); | ||
} | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Enables all previously disabled attachments | ||
* | ||
* @return void | ||
* @author Jose Diaz-Gonzalez | ||
*/ | ||
function enableAllBehaviors() { | ||
$behaviors = $this->Behaviors->attached(); | ||
foreach($behaviors as &$behavior) { | ||
if (!$this->Behaviors->enabled($behavior)) { | ||
$this->Behaviors->enable($behavior); | ||
} | ||
} | ||
} | ||
|
||
function __findDistinct($fields = array()) { | ||
$fields = (is_array($fields)) ? $fields : array($fields); | ||
|
||
foreach ($fields as &$field) { | ||
$field = "DISTINCT {$field}"; | ||
} | ||
|
||
return $this->find('all', array( | ||
'contain' => false, | ||
'fields' => $fields)); | ||
} | ||
} | ||
?> |
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,70 @@ | ||
;<?php exit() ?> | ||
; SVN FILE: $Id$ | ||
;/** | ||
; * Short description for file. | ||
; * | ||
; * | ||
; * PHP versions 4 and 5 | ||
; * | ||
; * CakePHP(tm) : Rapid Development Framework http://www.cakephp.org/ | ||
; * Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org) | ||
; * | ||
; * Licensed under The MIT License | ||
; * Redistributions of files must retain the above copyright notice. | ||
; * | ||
; * @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org) | ||
; * @link http://cakephp.org CakePHP(tm) Project | ||
; * @package cake | ||
; * @subpackage cake.app.config | ||
; * @since CakePHP(tm) v 0.10.0.1076 | ||
; * @license MIT License (http://www.opensource.org/licenses/mit-license.php) | ||
; */ | ||
|
||
; 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 |
Oops, something went wrong.