aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2013-10-17 14:20:59 +0200
committerMarc Alexander <admin@m-a-styles.de>2013-10-17 14:20:59 +0200
commite1fc008d15b14b383934c6a0291105377a852b53 (patch)
tree3082305d97ce7b18091b6626dfd5ff85c18a471f
parent852b707b48cef513318d52db1d2a5f40621636d6 (diff)
downloadforums-e1fc008d15b14b383934c6a0291105377a852b53.tar
forums-e1fc008d15b14b383934c6a0291105377a852b53.tar.gz
forums-e1fc008d15b14b383934c6a0291105377a852b53.tar.bz2
forums-e1fc008d15b14b383934c6a0291105377a852b53.tar.xz
forums-e1fc008d15b14b383934c6a0291105377a852b53.zip
[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
-rw-r--r--phpBB/config/avatars.yml4
-rw-r--r--phpBB/phpbb/avatar/driver/driver.php9
-rw-r--r--phpBB/phpbb/avatar/driver/local.php2
-rw-r--r--phpBB/phpbb/avatar/driver/upload.php2
4 files changed, 14 insertions, 3 deletions
diff --git a/phpBB/config/avatars.yml b/phpBB/config/avatars.yml
index 31ae1ecef9..5dae067642 100644
--- a/phpBB/config/avatars.yml
+++ b/phpBB/config/avatars.yml
@@ -6,6 +6,7 @@ services:
- %core.root_path%
- %core.php_ext%
- @cache.driver
+ - @path_helper
calls:
- [set_name, [avatar.driver.gravatar]]
tags:
@@ -18,6 +19,7 @@ services:
- %core.root_path%
- %core.php_ext%
- @cache.driver
+ - @path_helper
calls:
- [set_name, [avatar.driver.local]]
tags:
@@ -30,6 +32,7 @@ services:
- %core.root_path%
- %core.php_ext%
- @cache.driver
+ - @path_helper
calls:
- [set_name, [avatar.driver.remote]]
tags:
@@ -42,6 +45,7 @@ services:
- %core.root_path%
- %core.php_ext%
- @cache.driver
+ - @path_helper
calls:
- [set_name, [avatar.driver.upload]]
tags:
diff --git a/phpBB/phpbb/avatar/driver/driver.php b/phpBB/phpbb/avatar/driver/driver.php
index 0c54951cbd..95585ab13f 100644
--- a/phpBB/phpbb/avatar/driver/driver.php
+++ b/phpBB/phpbb/avatar/driver/driver.php
@@ -54,6 +54,12 @@ abstract class driver implements \phpbb\avatar\driver\driver_interface
protected $cache;
/**
+ * Path Helper
+ * @var \phpbb\path_helper
+ */
+ protected $path_helper;
+
+ /**
* Array of allowed avatar image extensions
* Array is used for setting the allowed extensions in the fileupload class
* and as a base for a regex of allowed extensions, which will be formed by
@@ -77,12 +83,13 @@ abstract class driver implements \phpbb\avatar\driver\driver_interface
* @param string $php_ext PHP file extension
* @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->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
$this->cache = $cache;
+ $this->path_helper = $path_helper;
}
/**
diff --git a/phpBB/phpbb/avatar/driver/local.php b/phpBB/phpbb/avatar/driver/local.php
index d779099c46..0686ffe79a 100644
--- a/phpBB/phpbb/avatar/driver/local.php
+++ b/phpBB/phpbb/avatar/driver/local.php
@@ -29,7 +29,7 @@ class local extends \phpbb\avatar\driver\driver
public function get_data($row)
{
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'],
'height' => $row['avatar_height'],
);
diff --git a/phpBB/phpbb/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php
index 377c9a0b04..bda872df7a 100644
--- a/phpBB/phpbb/avatar/driver/upload.php
+++ b/phpBB/phpbb/avatar/driver/upload.php
@@ -29,7 +29,7 @@ class upload extends \phpbb\avatar\driver\driver
public function get_data($row, $ignore_config = false)
{
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'],
'height' => $row['avatar_height'],
);