mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
[ticket/11930] Use \phpbb\path_helper for avatar URLs
This will ensure that avatars still properly display on extension pages supplied via app.php. PHPBB3-11930
This commit is contained in:
parent
852b707b48
commit
e1fc008d15
4 changed files with 14 additions and 3 deletions
|
@ -6,6 +6,7 @@ services:
|
||||||
- %core.root_path%
|
- %core.root_path%
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
- @cache.driver
|
- @cache.driver
|
||||||
|
- @path_helper
|
||||||
calls:
|
calls:
|
||||||
- [set_name, [avatar.driver.gravatar]]
|
- [set_name, [avatar.driver.gravatar]]
|
||||||
tags:
|
tags:
|
||||||
|
@ -18,6 +19,7 @@ services:
|
||||||
- %core.root_path%
|
- %core.root_path%
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
- @cache.driver
|
- @cache.driver
|
||||||
|
- @path_helper
|
||||||
calls:
|
calls:
|
||||||
- [set_name, [avatar.driver.local]]
|
- [set_name, [avatar.driver.local]]
|
||||||
tags:
|
tags:
|
||||||
|
@ -30,6 +32,7 @@ services:
|
||||||
- %core.root_path%
|
- %core.root_path%
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
- @cache.driver
|
- @cache.driver
|
||||||
|
- @path_helper
|
||||||
calls:
|
calls:
|
||||||
- [set_name, [avatar.driver.remote]]
|
- [set_name, [avatar.driver.remote]]
|
||||||
tags:
|
tags:
|
||||||
|
@ -42,6 +45,7 @@ services:
|
||||||
- %core.root_path%
|
- %core.root_path%
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
- @cache.driver
|
- @cache.driver
|
||||||
|
- @path_helper
|
||||||
calls:
|
calls:
|
||||||
- [set_name, [avatar.driver.upload]]
|
- [set_name, [avatar.driver.upload]]
|
||||||
tags:
|
tags:
|
||||||
|
|
|
@ -53,6 +53,12 @@ abstract class driver implements \phpbb\avatar\driver\driver_interface
|
||||||
*/
|
*/
|
||||||
protected $cache;
|
protected $cache;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Path Helper
|
||||||
|
* @var \phpbb\path_helper
|
||||||
|
*/
|
||||||
|
protected $path_helper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array of allowed avatar image extensions
|
* Array of allowed avatar image extensions
|
||||||
* Array is used for setting the allowed extensions in the fileupload class
|
* Array is used for setting the allowed extensions in the fileupload class
|
||||||
|
@ -77,12 +83,13 @@ abstract class driver implements \phpbb\avatar\driver\driver_interface
|
||||||
* @param string $php_ext PHP file extension
|
* @param string $php_ext PHP file extension
|
||||||
* @param \phpbb\cache\driver\driver_interface $cache Cache driver
|
* @param \phpbb\cache\driver\driver_interface $cache Cache driver
|
||||||
*/
|
*/
|
||||||
public function __construct(\phpbb\config\config $config, $phpbb_root_path, $php_ext, \phpbb\cache\driver\driver_interface $cache = null)
|
public function __construct(\phpbb\config\config $config, $phpbb_root_path, $php_ext, \phpbb\cache\driver\driver_interface $cache = null, \phpbb\path_helper $path_helper)
|
||||||
{
|
{
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->phpbb_root_path = $phpbb_root_path;
|
$this->phpbb_root_path = $phpbb_root_path;
|
||||||
$this->php_ext = $php_ext;
|
$this->php_ext = $php_ext;
|
||||||
$this->cache = $cache;
|
$this->cache = $cache;
|
||||||
|
$this->path_helper = $path_helper;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -29,7 +29,7 @@ class local extends \phpbb\avatar\driver\driver
|
||||||
public function get_data($row)
|
public function get_data($row)
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'src' => $this->phpbb_root_path . $this->config['avatar_gallery_path'] . '/' . $row['avatar'],
|
'src' => $this->path_helper->get_web_root_path() . $this->config['avatar_gallery_path'] . '/' . $row['avatar'],
|
||||||
'width' => $row['avatar_width'],
|
'width' => $row['avatar_width'],
|
||||||
'height' => $row['avatar_height'],
|
'height' => $row['avatar_height'],
|
||||||
);
|
);
|
||||||
|
|
|
@ -29,7 +29,7 @@ class upload extends \phpbb\avatar\driver\driver
|
||||||
public function get_data($row, $ignore_config = false)
|
public function get_data($row, $ignore_config = false)
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'src' => $this->phpbb_root_path . 'download/file.' . $this->php_ext . '?avatar=' . $row['avatar'],
|
'src' => $this->path_helper->get_web_root_path() . 'download/file.' . $this->php_ext . '?avatar=' . $row['avatar'],
|
||||||
'width' => $row['avatar_width'],
|
'width' => $row['avatar_width'],
|
||||||
'height' => $row['avatar_height'],
|
'height' => $row['avatar_height'],
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Reference in a new issue