aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2012-11-30 15:12:34 +0100
committerMarc Alexander <admin@m-a-styles.de>2012-11-30 15:12:34 +0100
commitd5cbedaaa28312c107ec562c78ffaa034595f336 (patch)
treed3befad8b3640244e10d6d97d58fc3a1a0d54ce0 /phpBB/includes
parent562ebe5c12b8a238b94a63ba53b694af4d061bc9 (diff)
downloadforums-d5cbedaaa28312c107ec562c78ffaa034595f336.tar
forums-d5cbedaaa28312c107ec562c78ffaa034595f336.tar.gz
forums-d5cbedaaa28312c107ec562c78ffaa034595f336.tar.bz2
forums-d5cbedaaa28312c107ec562c78ffaa034595f336.tar.xz
forums-d5cbedaaa28312c107ec562c78ffaa034595f336.zip
[feature/avatars] Let avatar manager handle $ignore_config
The avatar manager already handles if avatars are enabled. It should also handle ignoring the config settings. PHPBB3-10018
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/acp/acp_groups.php2
-rw-r--r--phpBB/includes/avatar/driver/driver.php4
-rw-r--r--phpBB/includes/avatar/driver/gravatar.php25
-rw-r--r--phpBB/includes/avatar/driver/interface.php16
-rw-r--r--phpBB/includes/avatar/driver/local.php23
-rw-r--r--phpBB/includes/avatar/driver/remote.php23
-rw-r--r--phpBB/includes/avatar/manager.php9
-rw-r--r--phpBB/includes/functions_display.php2
8 files changed, 35 insertions, 69 deletions
diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php
index a15a1b9a78..75956736f7 100644
--- a/phpBB/includes/acp/acp_groups.php
+++ b/phpBB/includes/acp/acp_groups.php
@@ -351,7 +351,7 @@ class acp_groups
}
else
{
- $avatar = $phpbb_avatar_manager->get_driver($user->data['user_avatar_type'])
+ $avatar = $phpbb_avatar_manager->get_driver($user->data['user_avatar_type']);
if ($avatar)
{
$avatar->delete($avatar_data);
diff --git a/phpBB/includes/avatar/driver/driver.php b/phpBB/includes/avatar/driver/driver.php
index cde4fd95a6..317fe91b83 100644
--- a/phpBB/includes/avatar/driver/driver.php
+++ b/phpBB/includes/avatar/driver/driver.php
@@ -78,7 +78,7 @@ abstract class phpbb_avatar_driver implements phpbb_avatar_driver_interface
/**
* @inheritdoc
*/
- public function get_data($row, $ignore_config = false)
+ public function get_data($row)
{
return array(
'src' => '',
@@ -90,7 +90,7 @@ abstract class phpbb_avatar_driver implements phpbb_avatar_driver_interface
/**
* @inheritdoc
*/
- public function get_custom_html($row, $ignore_config = false, $alt = '')
+ public function get_custom_html($row, $alt = '')
{
return '';
}
diff --git a/phpBB/includes/avatar/driver/gravatar.php b/phpBB/includes/avatar/driver/gravatar.php
index 6ceac1a149..001a741c3f 100644
--- a/phpBB/includes/avatar/driver/gravatar.php
+++ b/phpBB/includes/avatar/driver/gravatar.php
@@ -29,30 +29,19 @@ class phpbb_avatar_driver_gravatar extends phpbb_avatar_driver
/**
* @inheritdoc
*/
- public function get_data($row, $ignore_config = false)
+ public function get_data($row)
{
- if ($ignore_config || $this->config['allow_avatar_gravatar'])
- {
- return array(
- 'src' => $row['avatar'],
- 'width' => $row['avatar_width'],
- 'height' => $row['avatar_height'],
- );
- }
- else
- {
- return array(
- 'src' => '',
- 'width' => 0,
- 'height' => 0,
- );
- }
+ return array(
+ 'src' => $row['avatar'],
+ 'width' => $row['avatar_width'],
+ 'height' => $row['avatar_height'],
+ );
}
/**
* @inheritdoc
*/
- public function get_custom_html($row, $ignore_config = false, $alt = '')
+ public function get_custom_html($row, $alt = '')
{
return '<img src="' . $this->get_gravatar_url($row) . '" ' .
($row['avatar_width'] ? ('width="' . $row['avatar_width'] . '" ') : '') .
diff --git a/phpBB/includes/avatar/driver/interface.php b/phpBB/includes/avatar/driver/interface.php
index 7a58a40b0c..bba4bd102e 100644
--- a/phpBB/includes/avatar/driver/interface.php
+++ b/phpBB/includes/avatar/driver/interface.php
@@ -31,23 +31,21 @@ interface phpbb_avatar_driver_interface
/**
* Get the avatar url and dimensions
*
- * @param $ignore_config Whether this function should respect the users prefs
- * and board configuration configuration option, or should just render
- * the avatar anyways. Useful for the ACP.
+ * @param array $row User data or group data that has been cleaned with
+ * phpbb_avatar_manager::clean_row
* @return array Avatar data, must have keys src, width and height, e.g.
- * ['src' => '', 'width' => 0, 'height' => 0]
+ * ['src' => '', 'width' => 0, 'height' => 0]
*/
- public function get_data($row, $ignore_config = false);
+ public function get_data($row);
/**
* Returns custom html if it is needed for displaying this avatar
*
- * @param bool $ignore_config Whether this function should respect the users prefs
- * and board configuration configuration option, or should just render
- * the avatar anyways. Useful for the ACP.
+ * @param string $alt Alternate text for avatar image
+ *
* @return string HTML
*/
- public function get_custom_html($row, $ignore_config = false, $alt = '');
+ public function get_custom_html($row, $alt = '');
/**
* Prepare form for changing the settings of this avatar
diff --git a/phpBB/includes/avatar/driver/local.php b/phpBB/includes/avatar/driver/local.php
index d46ac79d11..479ee3712a 100644
--- a/phpBB/includes/avatar/driver/local.php
+++ b/phpBB/includes/avatar/driver/local.php
@@ -24,24 +24,13 @@ class phpbb_avatar_driver_local extends phpbb_avatar_driver
/**
* @inheritdoc
*/
- public function get_data($row, $ignore_config = false)
+ public function get_data($row)
{
- if ($ignore_config || $this->config['allow_avatar_local'])
- {
- return array(
- 'src' => $this->phpbb_root_path . $this->config['avatar_gallery_path'] . '/' . $row['avatar'],
- 'width' => $row['avatar_width'],
- 'height' => $row['avatar_height'],
- );
- }
- else
- {
- return array(
- 'src' => '',
- 'width' => 0,
- 'height' => 0,
- );
- }
+ return array(
+ 'src' => $this->phpbb_root_path . $this->config['avatar_gallery_path'] . '/' . $row['avatar'],
+ 'width' => $row['avatar_width'],
+ 'height' => $row['avatar_height'],
+ );
}
/**
diff --git a/phpBB/includes/avatar/driver/remote.php b/phpBB/includes/avatar/driver/remote.php
index 1da5fc16e8..344275a251 100644
--- a/phpBB/includes/avatar/driver/remote.php
+++ b/phpBB/includes/avatar/driver/remote.php
@@ -24,24 +24,13 @@ class phpbb_avatar_driver_remote extends phpbb_avatar_driver
/**
* @inheritdoc
*/
- public function get_data($row, $ignore_config = false)
+ public function get_data($row)
{
- if ($ignore_config || $this->config['allow_avatar_remote'])
- {
- return array(
- 'src' => $row['avatar'],
- 'width' => $row['avatar_width'],
- 'height' => $row['avatar_height'],
- );
- }
- else
- {
- return array(
- 'src' => '',
- 'width' => 0,
- 'height' => 0,
- );
- }
+ return array(
+ 'src' => $row['avatar'],
+ 'width' => $row['avatar_width'],
+ 'height' => $row['avatar_height'],
+ );
}
/**
diff --git a/phpBB/includes/avatar/manager.php b/phpBB/includes/avatar/manager.php
index 8953557acb..a0e1070322 100644
--- a/phpBB/includes/avatar/manager.php
+++ b/phpBB/includes/avatar/manager.php
@@ -54,15 +54,16 @@ class phpbb_avatar_manager
/**
* Get the driver object specified by the avatar type
*
- * @param string Avatar type; by default an avatar's service container name
+ * @param string $avatar_type Avatar type; by default an avatar's service container name
+ * @param bool $force_all Grab all avatar drivers, no matter if enabled or not
*
* @return object Avatar driver object
*/
- public function get_driver($avatar_type)
+ public function get_driver($avatar_type, $force_all = false)
{
- if (self::$valid_drivers === false)
+ if (self::$valid_drivers === false || $force_all)
{
- $this->load_valid_drivers();
+ $this->load_valid_drivers($force_all);
}
// Legacy stuff...
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index a7b28acac1..f88d8c9054 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -1367,7 +1367,7 @@ function get_avatar($row, $alt, $ignore_config = false)
);
$phpbb_avatar_manager = $phpbb_container->get('avatar.manager');
- $avatar = $phpbb_avatar_manager->get_driver($row['avatar_type']);
+ $avatar = $phpbb_avatar_manager->get_driver($row['avatar_type'], $ignore_config);
$html = '';
if ($avatar)