[ticket/11700] Correctly load templates for extensions

PHPBB3-11700
This commit is contained in:
Nils Adermann 2013-09-19 19:53:57 +02:00
parent 16fdef4866
commit 6b71284681
2 changed files with 7 additions and 7 deletions

View file

@ -499,12 +499,12 @@ class p_master
* the style paths for the extension (the ext author can change them * the style paths for the extension (the ext author can change them
* if necessary). * if necessary).
*/ */
$module_dir = explode('_', get_class($this->module)); $module_dir = explode('\\', get_class($this->module));
// 0 phpbb, 1 ext, 2 vendor, 3 extension name, ... // 0 vendor, 1 extension name, ...
if (isset($module_dir[3]) && $module_dir[1] === 'ext') if (isset($module_dir[1]))
{ {
$module_style_dir = $phpbb_root_path . 'ext/' . $module_dir[2] . '/' . $module_dir[3] . '/adm/style'; $module_style_dir = $phpbb_root_path . 'ext/' . $module_dir[0] . '/' . $module_dir[1] . '/adm/style';
if (is_dir($module_style_dir)) if (is_dir($module_style_dir))
{ {
@ -973,7 +973,7 @@ class p_master
*/ */
protected function get_short_name($basename) protected function get_short_name($basename)
{ {
if (substr($basename, 0, 6) === 'phpbb_') if (substr($basename, 0, 6) === 'phpbb\\' || strpos($basename, '\\') !== false)
{ {
return $basename; return $basename;
} }
@ -990,6 +990,6 @@ class p_master
*/ */
protected function is_full_class($basename) protected function is_full_class($basename)
{ {
return (preg_match('/^(phpbb|ucp|mcp|acp)_/', $basename)); return (strpos($basename, '\\') !== false || preg_match('/^(ucp|mcp|acp)_/', $basename));
} }
} }

View file

@ -90,7 +90,7 @@ class phpbb_functional_extension_module_test extends phpbb_functional_test_case
{ {
$this->login(); $this->login();
$this->admin_login(); $this->admin_login();
$crawler = self::request('GET', 'adm/index.php?i=foo\\bar\\acp\\main_module&mode=mode&sid=' . $this->sid); $crawler = self::request('GET', 'adm/index.php?i=foo%5cbar%5cacp%5cmain_module&mode=mode&sid=' . $this->sid);
$this->assertContains("Bertie rulez!", $crawler->filter('#main')->text()); $this->assertContains("Bertie rulez!", $crawler->filter('#main')->text());
$this->phpbb_extension_manager->purge('foo/bar'); $this->phpbb_extension_manager->purge('foo/bar');
} }