diff options
Diffstat (limited to 'phpBB/phpbb/avatar')
| -rw-r--r-- | phpBB/phpbb/avatar/driver/driver.php | 18 | ||||
| -rw-r--r-- | phpBB/phpbb/avatar/driver/driver_interface.php | 8 | ||||
| -rw-r--r-- | phpBB/phpbb/avatar/driver/gravatar.php | 8 | ||||
| -rw-r--r-- | phpBB/phpbb/avatar/driver/local.php | 10 | ||||
| -rw-r--r-- | phpBB/phpbb/avatar/driver/remote.php | 8 | ||||
| -rw-r--r-- | phpBB/phpbb/avatar/driver/upload.php | 10 | ||||
| -rw-r--r-- | phpBB/phpbb/avatar/manager.php | 38 | 
7 files changed, 30 insertions, 70 deletions
| diff --git a/phpBB/phpbb/avatar/driver/driver.php b/phpBB/phpbb/avatar/driver/driver.php index 0c54951cbd..d360614122 100644 --- a/phpBB/phpbb/avatar/driver/driver.php +++ b/phpBB/phpbb/avatar/driver/driver.php @@ -10,14 +10,6 @@  namespace phpbb\avatar\driver;  /** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ -	exit; -} - -/**  * Base class for avatar drivers  * @package phpBB3  */ @@ -48,6 +40,12 @@ abstract class driver implements \phpbb\avatar\driver\driver_interface  	protected $php_ext;  	/** +	* Path Helper +	* @var \phpbb\path_helper +	*/ +	protected $path_helper; + +	/**  	* Cache driver  	* @var \phpbb\cache\driver\driver_interface  	*/ @@ -75,13 +73,15 @@ abstract class driver implements \phpbb\avatar\driver\driver_interface  	* @param \phpbb\request\request $request Request object  	* @param string $phpbb_root_path Path to the phpBB root  	* @param string $php_ext PHP file extension +	* @param \phpbb_path_helper $path_helper phpBB path helper  	* @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\path_helper $path_helper, \phpbb\cache\driver\driver_interface $cache = null)  	{  		$this->config = $config;  		$this->phpbb_root_path = $phpbb_root_path;  		$this->php_ext = $php_ext; +		$this->path_helper = $path_helper;  		$this->cache = $cache;  	} diff --git a/phpBB/phpbb/avatar/driver/driver_interface.php b/phpBB/phpbb/avatar/driver/driver_interface.php index d9540c19db..7f049469a2 100644 --- a/phpBB/phpbb/avatar/driver/driver_interface.php +++ b/phpBB/phpbb/avatar/driver/driver_interface.php @@ -10,14 +10,6 @@  namespace phpbb\avatar\driver;  /** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ -	exit; -} - -/**  * Interface for avatar drivers  * @package phpBB3  */ diff --git a/phpBB/phpbb/avatar/driver/gravatar.php b/phpBB/phpbb/avatar/driver/gravatar.php index 3ad783932e..d64f4da734 100644 --- a/phpBB/phpbb/avatar/driver/gravatar.php +++ b/phpBB/phpbb/avatar/driver/gravatar.php @@ -10,14 +10,6 @@  namespace phpbb\avatar\driver;  /** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ -	exit; -} - -/**  * Handles avatars hosted at gravatar.com  * @package phpBB3  */ diff --git a/phpBB/phpbb/avatar/driver/local.php b/phpBB/phpbb/avatar/driver/local.php index d779099c46..f6acc6e636 100644 --- a/phpBB/phpbb/avatar/driver/local.php +++ b/phpBB/phpbb/avatar/driver/local.php @@ -10,14 +10,6 @@  namespace phpbb\avatar\driver;  /** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ -	exit; -} - -/**  * Handles avatars selected from the board gallery  * @package phpBB3  */ @@ -29,7 +21,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/remote.php b/phpBB/phpbb/avatar/driver/remote.php index 1aa638dfe5..12cbd883f4 100644 --- a/phpBB/phpbb/avatar/driver/remote.php +++ b/phpBB/phpbb/avatar/driver/remote.php @@ -10,14 +10,6 @@  namespace phpbb\avatar\driver;  /** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ -	exit; -} - -/**  * Handles avatars hosted remotely  * @package phpBB3  */ diff --git a/phpBB/phpbb/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php index 377c9a0b04..822c40af98 100644 --- a/phpBB/phpbb/avatar/driver/upload.php +++ b/phpBB/phpbb/avatar/driver/upload.php @@ -10,14 +10,6 @@  namespace phpbb\avatar\driver;  /** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ -	exit; -} - -/**  * Handles avatars uploaded to the board  * @package phpBB3  */ @@ -29,7 +21,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'],  		); diff --git a/phpBB/phpbb/avatar/manager.php b/phpBB/phpbb/avatar/manager.php index c28380a401..5fe5e2b0a1 100644 --- a/phpBB/phpbb/avatar/manager.php +++ b/phpBB/phpbb/avatar/manager.php @@ -10,14 +10,6 @@  namespace phpbb\avatar;  /** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ -	exit; -} - -/**  * @package avatar  */  class manager @@ -42,12 +34,6 @@ class manager  	protected $avatar_drivers;  	/** -	* Service container object -	* @var object -	*/ -	protected $container; - -	/**  	* Default avatar data row  	* @var array  	*/ @@ -63,13 +49,27 @@ class manager  	*  	* @param \phpbb\config\config $config phpBB configuration  	* @param array $avatar_drivers Avatar drivers passed via the service container -	* @param object $container Container object  	*/ -	public function __construct(\phpbb\config\config $config, $avatar_drivers, $container) +	public function __construct(\phpbb\config\config $config, $avatar_drivers)  	{  		$this->config = $config; -		$this->avatar_drivers = $avatar_drivers; -		$this->container = $container; +		$this->register_avatar_drivers($avatar_drivers); +	} + +	/** +	* Register avatar drivers +	* +	* @param array $avatar_drivers Service collection of avatar drivers +	*/ +	protected function register_avatar_drivers($avatar_drivers) +	{ +		if (!empty($avatar_drivers)) +		{ +			foreach ($avatar_drivers as $driver) +			{ +				$this->avatar_drivers[$driver->get_name()] = $driver; +			} +		}  	}  	/** @@ -112,7 +112,7 @@ class manager  		* There is no need to handle invalid avatar types as the following code  		* will cause a ServiceNotFoundException if the type does not exist  		*/ -		$driver = $this->container->get($avatar_type); +		$driver = $this->avatar_drivers[$avatar_type];  		return $driver;  	} | 
