mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Merge branch 'local/svn/1.2.x.x' into 1.2
This commit is contained in:
commit
dbd2644a52
4 changed files with 52 additions and 14 deletions
|
@ -632,7 +632,9 @@ class EmailComponent extends Object{
|
|||
* @access private
|
||||
*/
|
||||
function __strip($value, $message = false) {
|
||||
$search = '%0a|%0d|Content-(?:Type|Transfer-Encoding)\:|charset\=|mime-version\:|multipart/mixed|(?:to|b?cc)\:.*';
|
||||
$search = '%0a|%0d|Content-(?:Type|Transfer-Encoding)\:';
|
||||
$search .= '|charset\=|mime-version\:|multipart/mixed|(?:[^a-z]to|b?cc)\:.*';
|
||||
|
||||
if ($message !== true) {
|
||||
$search .= '|\r|\n';
|
||||
}
|
||||
|
|
|
@ -627,16 +627,22 @@ class DboSource extends DataSource {
|
|||
$queryData['fields'] = $this->fields($model);
|
||||
}
|
||||
|
||||
foreach ($model->__associations as $type) {
|
||||
foreach ($model->{$type} as $assoc => $assocData) {
|
||||
if ($model->recursive > -1) {
|
||||
$linkModel =& $model->{$assoc};
|
||||
$external = isset($assocData['external']);
|
||||
$_associations = $model->__associations;
|
||||
|
||||
if ($model->useDbConfig == $linkModel->useDbConfig) {
|
||||
if (true === $this->generateAssociationQuery($model, $linkModel, $type, $assoc, $assocData, $queryData, $external, $null)) {
|
||||
$linkedModels[] = $type . '/' . $assoc;
|
||||
}
|
||||
if ($model->recursive == -1) {
|
||||
$_associations = array();
|
||||
} else if ($model->recursive == 0) {
|
||||
unset($_associations[2], $_associations[3]);
|
||||
}
|
||||
|
||||
foreach ($_associations as $type) {
|
||||
foreach ($model->{$type} as $assoc => $assocData) {
|
||||
$linkModel =& $model->{$assoc};
|
||||
$external = isset($assocData['external']);
|
||||
|
||||
if ($model->useDbConfig == $linkModel->useDbConfig) {
|
||||
if (true === $this->generateAssociationQuery($model, $linkModel, $type, $assoc, $assocData, $queryData, $external, $null)) {
|
||||
$linkedModels[$type . '/' . $assoc] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -653,12 +659,12 @@ class DboSource extends DataSource {
|
|||
|
||||
$filtered = $this->__filterResults($resultSet, $model);
|
||||
|
||||
if ($model->recursive > 0) {
|
||||
foreach ($model->__associations as $type) {
|
||||
if ($model->recursive > -1) {
|
||||
foreach ($_associations as $type) {
|
||||
foreach ($model->{$type} as $assoc => $assocData) {
|
||||
$linkModel =& $model->{$assoc};
|
||||
|
||||
if (!in_array($type . '/' . $assoc, $linkedModels)) {
|
||||
if (empty($linkedModels[$type . '/' . $assoc])) {
|
||||
if ($model->useDbConfig == $linkModel->useDbConfig) {
|
||||
$db =& $this;
|
||||
} else {
|
||||
|
|
|
@ -104,6 +104,15 @@ class EmailTestComponent extends EmailComponent {
|
|||
function getMessage() {
|
||||
return $this->__message;
|
||||
}
|
||||
/**
|
||||
* Convenience method for testing.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
function strip($content, $message = false) {
|
||||
return parent::__strip($content, $message);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* EmailTestController class
|
||||
|
@ -499,9 +508,21 @@ TEXTBLOC;
|
|||
$content = "Previous content\n--alt-\nContent-TypeContent-Type:: text/html; charsetcharset==utf-8\nContent-Transfer-Encoding: 7bit";
|
||||
$content .= "\n\n<p>My own html content</p>";
|
||||
|
||||
$result = $this->Controller->EmailTest->__strip($content, true);
|
||||
$result = $this->Controller->EmailTest->strip($content, true);
|
||||
$expected = "Previous content\n--alt-\n text/html; utf-8\n 7bit\n\n<p>My own html content</p>";
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$content = '<p>Some HTML content with an <a href="mailto:test@example.com">email link</a>';
|
||||
$result = $this->Controller->EmailTest->strip($content, true);
|
||||
$expected = $content;
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$content = '<p>Some HTML content with an ';
|
||||
$content .= '<a href="mailto:test@example.com,test2@example.com">email link</a>';
|
||||
$result = $this->Controller->EmailTest->strip($content, true);
|
||||
$expected = $content;
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
}
|
||||
/**
|
||||
* testMultibyte method
|
||||
|
|
|
@ -12082,6 +12082,15 @@ class ModelTest extends CakeTestCase {
|
|||
$TestModel->User->setDataSource('test2');
|
||||
$TestModel->Comment->setDataSource('test2');
|
||||
|
||||
foreach ($expected as $key => $value) {
|
||||
unset($value['Comment'], $value['Tag']);
|
||||
$expected[$key] = $value;
|
||||
}
|
||||
|
||||
$TestModel->recursive = 0;
|
||||
$result = $TestModel->find('all');
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$result = Set::extract($TestModel->User->find('all'), '{n}.User.id');
|
||||
$this->assertEqual($result, array('1', '2', '3', '4'));
|
||||
$this->assertEqual($TestModel->find('all'), $expected);
|
||||
|
|
Loading…
Add table
Reference in a new issue