Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Commit

Permalink
MERGE 2.0 into 2.0-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
skie committed Jul 23, 2012
1 parent a2abcd4 commit 0584b39
Show file tree
Hide file tree
Showing 31 changed files with 890 additions and 123 deletions.
6 changes: 3 additions & 3 deletions Controller/Component/ArchiveComponent.php
Expand Up @@ -57,16 +57,16 @@ class ArchiveComponent extends Object {
*
* @param object
*/
public function startup(&$controller) {
public function startup(Controller $controller) {
$this->controller =& $controller;
if (empty($this->modelName)) {
$this->modelName = $controller->modelClass;
}
$parsedParams = array();

foreach ($this->_parameters as $param) {
if (isset($controller->params[$param]) && is_numeric($controller->params[$param])) {
$parsedParams[$param] = $controller->params[$param];
if (isset($controller->request->params[$param]) && is_numeric($controller->request->params[$param])) {
$parsedParams[$param] = $controller->request->params[$param];
}
}
if (empty($parsedParams)) {
Expand Down
20 changes: 10 additions & 10 deletions Controller/Component/FormPreserverComponent.php
Expand Up @@ -82,7 +82,7 @@ public function __construct() {
*
* @param object Controller object
*/
public function initialize(&$Controller) {
public function initialize(Controller $Controller) {
$this->Controller = $Controller;
$this->sessionPath = $this->sessionKey . '.' . $Controller->name . '.' . $Controller->action;
}
Expand All @@ -94,15 +94,15 @@ public function initialize(&$Controller) {
* @return void
*/

public function startUp(&$Controller) {
public function startUp(Controller $Controller) {
if (in_array($Controller->action, $this->actions)) {
if (empty($Controller->data) && $Controller->Session->check($this->sessionPath)) {
if (empty($Controller->request->data) && $Controller->Session->check($this->sessionPath)) {
if ($this->directPost == true) {
$Controller->data = $Controller->Session->read($this->sessionPath);
$Controller->request->data = $Controller->Session->read($this->sessionPath);
$Controller->Session->delete($this->sessionPath);
}
} elseif (!empty($Controller->data) && !$Controller->Auth->user()) {
$this->preserve($Controller->data);
} elseif (!empty($Controller->request->data) && !$Controller->Auth->user()) {
$this->preserve($Controller->request->data);
if (empty($this->loginAction) && !empty($Controller->Auth->loginAction)) {
$this->loginAction = $Controller->Auth->loginAction;
if (!empty($this->redirectMessage)) {
Expand Down Expand Up @@ -153,11 +153,11 @@ public function preserve($data = null, $sessionPath = null) {
*/
public function restore($sessionPath = null) {
$this->_overridPath($sessionPath);
if (empty($this->Controller->data) && $this->Controller->Session->check($this->sessionPath)) {
if (!empty($this->Controller->data)) {
$this->Controller->data = array_merge($this->Controller->Session->read($this->sessionPath), $this->Controller->data);
if (empty($this->Controller->request->data) && $this->Controller->Session->check($this->sessionPath)) {
if (!empty($this->Controller->request->data)) {
$this->Controller->request->data = array_merge($this->Controller->Session->read($this->sessionPath), $this->Controller->request->data);
} else {
$this->Controller->data = $this->Controller->Session->read($this->sessionPath);
$this->Controller->request->data = $this->Controller->Session->read($this->sessionPath);
}
$this->Controller->Session->delete($this->sessionPath);
}
Expand Down
10 changes: 5 additions & 5 deletions Controller/Component/RefererComponent.php
Expand Up @@ -17,7 +17,7 @@
* @package utils
* @subpackage utils.controllers.components
*/
class RefererComponent extends Object {
class RefererComponent extends Component {

/**
* Controller object instance
Expand All @@ -31,7 +31,7 @@ class RefererComponent extends Object {
*
* @param object Controller object
*/
public function initialize(&$controller) {
public function initialize($controller) {
$this->Controller = $controller;
}

Expand All @@ -40,7 +40,7 @@ public function initialize(&$controller) {
*
* @param object Controller object
*/
public function startup(&$controller) {
public function startup($controller) {
$this->setReferer();
}

Expand All @@ -51,7 +51,7 @@ public function startup(&$controller) {
*/
public function setReferer($default = null) {
if (empty($this->Controller->request->data['Data']['referer'])) {
$referer = $this->Controller->request->referer();
$referer = $this->Controller->referer();

if ($referer == '/' && !empty($default)) {
$referer = $default;
Expand All @@ -78,7 +78,7 @@ public function redirect($url, $status = null, $exit = true) {
if (isset($this->Controller->data['Data']['referer'])) {
$referer = $this->Controller->request->data['Data']['referer'];
} else {
$referer = $this->Controller->request->referer();
$referer = $this->Controller->referer();
}

if (strlen($referer) == 0 || $referer == '/') {
Expand Down
4 changes: 2 additions & 2 deletions Model/Behavior/InheritableBehavior.php
Expand Up @@ -194,8 +194,8 @@ public function beforeValidate(Model $Model) {
*/
protected function _singleTableBeforeFind(Model $Model, $query) {
extract($this->settings[$Model->alias]);

if (isset($Model->_schema[$inheritanceField]) && $Model->alias != $Model->parent->alias) {
$_schema = $Model->schema();
if (isset($_schema[$inheritanceField]) && $Model->alias != $Model->parent->alias) {
$field = $Model->alias. '.' . $inheritanceField;

if (!isset($query['conditions'])) {
Expand Down
2 changes: 2 additions & 0 deletions Model/Behavior/LookupableBehavior.php
Expand Up @@ -17,6 +17,8 @@
* @package utils
* @subpackage utils.models.behaviors
*/
App::uses('ModelBehavior', 'Model');

class LookupableBehavior extends ModelBehavior {

/**
Expand Down
1 change: 1 addition & 0 deletions Model/Behavior/PingbackableBehavior.php
Expand Up @@ -12,6 +12,7 @@
App::uses('HttpSocket', 'Network/Http');
App::uses('Xml', 'Utility');

App::uses('ModelBehavior', 'Model');


App::import('Lib', 'Xmlrpc.Xmlrpc');
Expand Down

0 comments on commit 0584b39

Please sign in to comment.