mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixing entity encoding of url strings inside remoteFunctions contained in safe CDATA blocks. Fixes #127
This commit is contained in:
parent
2cf294a749
commit
0fda18d11c
2 changed files with 16 additions and 1 deletions
|
@ -212,6 +212,7 @@ class AjaxHelper extends AppHelper {
|
|||
unset($confirm);
|
||||
}
|
||||
$htmlOptions = $this->__getHtmlOptions($options, array('url'));
|
||||
$options += array('safe' => true);
|
||||
|
||||
if (empty($options['fallback']) || !isset($options['fallback'])) {
|
||||
$options['fallback'] = $href;
|
||||
|
@ -257,7 +258,14 @@ class AjaxHelper extends AppHelper {
|
|||
$func = "new Ajax.Request(";
|
||||
}
|
||||
|
||||
$func .= "'" . $this->url(isset($options['url']) ? $options['url'] : "") . "'";
|
||||
$url = isset($options['url']) ? $options['url'] : "";
|
||||
if (empty($options['safe'])) {
|
||||
$url = $this->url($url);
|
||||
} else {
|
||||
$url = Router::url($url);
|
||||
}
|
||||
|
||||
$func .= "'" . $url . "'";
|
||||
$func .= ", " . $this->__optionsForAjax($options) . ")";
|
||||
|
||||
if (isset($options['before'])) {
|
||||
|
|
|
@ -557,6 +557,13 @@ class AjaxHelperTest extends CakeTestCase {
|
|||
$this->assertPattern("/Event.observe\('link[0-9]+', [\w\d,'\(\)\s{}]+Ajax\.Request\([\w\d\s,'\(\){}:\/]+onComplete:function\(request, json\) {test}/", $result);
|
||||
$this->assertNoPattern('/^<a[^<>]+complete="test"[^<>]*>Ajax Link<\/a>/', $result);
|
||||
$this->assertNoPattern('/^<a\s+[^<>]*url="[^"]*"[^<>]*>/', $result);
|
||||
|
||||
$result = $this->Ajax->link(
|
||||
'Ajax Link',
|
||||
array('controller' => 'posts', 'action' => 'index', '?' => array('one' => '1', 'two' => '2')),
|
||||
array('update' => 'myDiv', 'id' => 'myLink')
|
||||
);
|
||||
$this->assertPattern('#/posts/\?one\=1\&two\=2#', $result);
|
||||
}
|
||||
/**
|
||||
* testRemoteTimer method
|
||||
|
|
Loading…
Reference in a new issue