Merge pull request #6502 from marc1706/ticket/13276-master

[ticket/13276] Support PHPBB_USE_BOARD_URL_PATH in web root path -- master version
This commit is contained in:
Marc Alexander 2023-08-06 20:30:54 +02:00 committed by GitHub
commit aac2cf5273
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 8 deletions

View file

@ -100,8 +100,7 @@ class upload extends \phpbb\avatar\driver\driver
return false; return false;
} }
$use_board = defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH; $web_path = $this->path_helper->get_web_root_path();
$web_path = $use_board ? generate_board_url() . '/' : $this->path_helper->get_web_root_path();
$template->assign_vars([ $template->assign_vars([
'AVATAR_ALLOWED_EXTENSIONS' => implode(',', preg_replace('/^/', '.', $this->allowed_extensions)), 'AVATAR_ALLOWED_EXTENSIONS' => implode(',', preg_replace('/^/', '.', $this->allowed_extensions)),

View file

@ -231,8 +231,7 @@ class helper
* We need to correct the phpBB root path in case this is called from a controller, * We need to correct the phpBB root path in case this is called from a controller,
* because the web path will be incorrect otherwise. * because the web path will be incorrect otherwise.
*/ */
$board_url = defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH; $web_path = $this->path_helper->get_web_root_path();
$web_path = $board_url ? generate_board_url() . '/' : $this->path_helper->get_web_root_path();
$style_path = rawurlencode($this->user->style['style_path']); $style_path = rawurlencode($this->user->style['style_path']);
return "{$web_path}styles/{$style_path}/theme/images/no_avatar.gif"; return "{$web_path}styles/{$style_path}/theme/images/no_avatar.gif";

View file

@ -95,15 +95,12 @@ class icon extends AbstractExtension
$filesystem = $environment->get_filesystem(); $filesystem = $environment->get_filesystem();
$root_path = $environment->get_web_root_path(); $root_path = $environment->get_web_root_path();
$board_url = defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH;
$base_path = $board_url ? generate_board_url() . '/' : $root_path;
// Iterate over the user's styles and check for icon existance // Iterate over the user's styles and check for icon existance
foreach ($this->get_style_list() as $style_path) foreach ($this->get_style_list() as $style_path)
{ {
if ($filesystem->exists("{$root_path}styles/{$style_path}/theme/png/{$icon}.png")) if ($filesystem->exists("{$root_path}styles/{$style_path}/theme/png/{$icon}.png"))
{ {
$source = "{$base_path}styles/{$style_path}/theme/png/{$icon}.png"; $source = "{$root_path}styles/{$style_path}/theme/png/{$icon}.png";
break; break;
} }