1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-09 16:17:14 +02:00

Issue #3912 Fix for partial route match. Partials should always end with a '/' for predictable results.

This commit is contained in:
Cameron
2021-02-26 11:56:10 -08:00
parent 8e1b547171
commit a427c14806
2 changed files with 5 additions and 2 deletions

View File

@@ -572,7 +572,7 @@ class e_theme
foreach($cusPageArray as $kpage)
{
// e_ROUTE
if(!empty($request['route']) && (strpos($kpage,':'.$request['route']) === 0))
if(!empty($request['route']) && (strpos(':'.$request['route'], $kpage) === 0))
{
return $lyout;
}

View File

@@ -453,6 +453,7 @@
0 => 'forum',
1 => 'user.php!', // <-- exact match of URL
2 => ':forum/index',
3 => ':myplugin/',
// 2 => '/user', // <-- Expecting URL to match both user and usersetting since it contains no "!"
),
@@ -512,6 +513,7 @@
// Using e_ROUTE;
24 => array('url' => 'whatever.php', 'script'=>'whatever.php', 'route'=> 'news/view/index', 'expected'=> 'other_layout'),
25 => array('url' => 'whatever.php', 'script'=>'whatever.php', 'route'=> 'forum/index', 'expected'=> 'jumbotron_full'),
26 => array('url' => 'whatever.php', 'script'=>'whatever.php', 'route'=> 'myplugin/index', 'expected'=> 'jumbotron_full'),
);
@@ -522,7 +524,8 @@
$var['script'] = isset($var['script']) ? $var['script'] : null;
$result = $themeObj::getThemeLayout($pref, $defaultLayout, $var);
$this->assertEquals($var['expected'],$result, "Wrong theme layout returned for item [".$item."] ".$var['url']);
$diz = isset($var['route']) ? $var['route'] : $var['url'];
$this->assertEquals($var['expected'],$result, "Wrong theme layout returned for item [".$item."] ".$diz);
// echo $var['url']."\t\t\t".$result."\n\n";
}