mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
ENHANCEMENT Url encoding URLSegments before matching them against database records in ModelAsController, to match behaviour of SiteTree with URLSegmentFilter::$default_allow_multibyte=true. Not an API change because all encodable characters have been removed by the default URLSegmentFilter already (see http://www.w3.org/International/articles/idn-and-iri/#iriproblem)
This commit is contained in:
parent
63536af875
commit
77e52d6344
@ -146,7 +146,7 @@ class ContentController extends Controller {
|
|||||||
if(class_exists('Translatable')) Translatable::disable_locale_filter();
|
if(class_exists('Translatable')) Translatable::disable_locale_filter();
|
||||||
// look for a page with this URLSegment
|
// look for a page with this URLSegment
|
||||||
$child = $this->model->SiteTree->where(sprintf (
|
$child = $this->model->SiteTree->where(sprintf (
|
||||||
"\"ParentID\" = %s AND \"URLSegment\" = '%s'", $this->ID, Convert::raw2sql($action)
|
"\"ParentID\" = %s AND \"URLSegment\" = '%s'", $this->ID, Convert::raw2sql(rawurlencode($action))
|
||||||
))->First();
|
))->First();
|
||||||
if(class_exists('Translatable')) Translatable::enable_locale_filter();
|
if(class_exists('Translatable')) Translatable::enable_locale_filter();
|
||||||
|
|
||||||
|
@ -87,14 +87,14 @@ class ModelAsController extends Controller implements NestedController {
|
|||||||
if(!$URLSegment = $request->param('URLSegment')) {
|
if(!$URLSegment = $request->param('URLSegment')) {
|
||||||
throw new Exception('ModelAsController->getNestedController(): was not passed a URLSegment value.');
|
throw new Exception('ModelAsController->getNestedController(): was not passed a URLSegment value.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find page by link, regardless of current locale settings
|
// Find page by link, regardless of current locale settings
|
||||||
if(class_exists('Translatable')) Translatable::disable_locale_filter();
|
if(class_exists('Translatable')) Translatable::disable_locale_filter();
|
||||||
$sitetree = DataObject::get_one(
|
$sitetree = DataObject::get_one(
|
||||||
'SiteTree',
|
'SiteTree',
|
||||||
sprintf(
|
sprintf(
|
||||||
'"URLSegment" = \'%s\' %s',
|
'"URLSegment" = \'%s\' %s',
|
||||||
Convert::raw2sql($URLSegment),
|
Convert::raw2sql(rawurlencode($URLSegment)),
|
||||||
(SiteTree::nested_urls() ? 'AND "ParentID" = 0' : null)
|
(SiteTree::nested_urls() ? 'AND "ParentID" = 0' : null)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -149,7 +149,7 @@ class ModelAsController extends Controller implements NestedController {
|
|||||||
* @return SiteTree
|
* @return SiteTree
|
||||||
*/
|
*/
|
||||||
static function find_old_page($URLSegment,$parentID = 0, $ignoreNestedURLs = false) {
|
static function find_old_page($URLSegment,$parentID = 0, $ignoreNestedURLs = false) {
|
||||||
$URLSegment = Convert::raw2sql($URLSegment);
|
$URLSegment = Convert::raw2sql(rawurlencode($URLSegment));
|
||||||
|
|
||||||
$useParentIDFilter = SiteTree::nested_urls() && $parentID;
|
$useParentIDFilter = SiteTree::nested_urls() && $parentID;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user