mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-25 20:58:55 +00:00
[feature/avatars] Only create avatar objects if necessary
PHPBB3-10018
This commit is contained in:
parent
ce5e2f1677
commit
67c2e48d15
7 changed files with 14 additions and 8 deletions
|
@ -128,8 +128,6 @@ $phpbb_subscriber_loader = $phpbb_container->get('event.subscriber_loader');
|
|||
$template = $phpbb_container->get('template');
|
||||
$phpbb_style = $phpbb_container->get('style');
|
||||
|
||||
$phpbb_avatar_manager = $phpbb_container->get('avatar.manager');
|
||||
|
||||
// Add own hook handler
|
||||
require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
|
||||
$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('phpbb_template', 'display')));
|
||||
|
|
|
@ -28,7 +28,7 @@ class acp_board
|
|||
{
|
||||
global $db, $user, $auth, $template;
|
||||
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||
global $cache, $phpbb_avatar_manager;
|
||||
global $cache, $phpbb_container;
|
||||
|
||||
$user->add_lang('acp/board');
|
||||
|
||||
|
@ -107,6 +107,7 @@ class acp_board
|
|||
break;
|
||||
|
||||
case 'avatar':
|
||||
$phpbb_avatar_manager = $phpbb_container->get('avatar.manager');
|
||||
$avatar_drivers = $phpbb_avatar_manager->get_valid_drivers();
|
||||
sort($avatar_drivers);
|
||||
$avatar_vars = array();
|
||||
|
|
|
@ -26,7 +26,7 @@ class acp_groups
|
|||
{
|
||||
global $config, $db, $user, $auth, $template, $cache;
|
||||
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $file_uploads;
|
||||
global $request, $phpbb_avatar_manager;
|
||||
global $request, $phpbb_container;
|
||||
|
||||
$user->add_lang('acp/groups');
|
||||
$this->tpl_name = 'acp_groups';
|
||||
|
@ -282,6 +282,7 @@ class acp_groups
|
|||
$user->add_lang('ucp');
|
||||
|
||||
// Setup avatar data for later
|
||||
$phpbb_avatar_manager = $phpbb_container->get('avatar.manager');
|
||||
$avatars_enabled = false;
|
||||
$avatar_drivers = null;
|
||||
$avatar_data = null;
|
||||
|
|
|
@ -33,7 +33,7 @@ class acp_users
|
|||
global $config, $db, $user, $auth, $template, $cache;
|
||||
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $file_uploads;
|
||||
global $phpbb_dispatcher, $request;
|
||||
global $phpbb_avatar_manager;
|
||||
global $phpbb_container;
|
||||
|
||||
$user->add_lang(array('posting', 'ucp', 'acp/users'));
|
||||
$this->tpl_name = 'acp_users';
|
||||
|
@ -468,6 +468,7 @@ class acp_users
|
|||
$db->sql_query($sql);
|
||||
|
||||
// Delete old avatar if present
|
||||
$phpbb_avatar_manager = $phpbb_container->get('avatar.manager');
|
||||
$driver = $phpbb_avatar_manager->get_driver($user_row['user_avatar_type']);
|
||||
if ($driver)
|
||||
{
|
||||
|
@ -1732,6 +1733,8 @@ class acp_users
|
|||
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
|
||||
|
||||
$avatars_enabled = false;
|
||||
$phpbb_avatar_manager = $phpbb_container->get('avatar.manager');
|
||||
|
||||
if ($config['allow_avatar'])
|
||||
{
|
||||
$avatar_drivers = $phpbb_avatar_manager->get_valid_drivers();
|
||||
|
|
|
@ -1353,7 +1353,7 @@ function get_avatar($row, $alt, $ignore_config = false)
|
|||
{
|
||||
global $user, $config, $cache, $phpbb_root_path, $phpEx;
|
||||
global $request;
|
||||
global $phpbb_avatar_manager;
|
||||
global $phpbb_container;
|
||||
|
||||
if (!$config['allow_avatar'] && !$ignore_config)
|
||||
{
|
||||
|
@ -1366,6 +1366,7 @@ function get_avatar($row, $alt, $ignore_config = false)
|
|||
'height' => $row['avatar_height'],
|
||||
);
|
||||
|
||||
$phpbb_avatar_manager = $phpbb_container->get('avatar.manager');
|
||||
$avatar = $phpbb_avatar_manager->get_driver($row['avatar_type']);
|
||||
|
||||
if ($avatar)
|
||||
|
|
|
@ -27,7 +27,7 @@ class ucp_groups
|
|||
{
|
||||
global $config, $phpbb_root_path, $phpEx;
|
||||
global $db, $user, $auth, $cache, $template;
|
||||
global $request, $phpbb_avatar_manager;
|
||||
global $request, $phpbb_container;
|
||||
|
||||
$user->add_lang('groups');
|
||||
|
||||
|
@ -484,6 +484,7 @@ class ucp_groups
|
|||
$error = array();
|
||||
|
||||
// Setup avatar data for later
|
||||
$phpbb_avatar_manager = $phpbb_container->get('avatar.manager');
|
||||
$avatars_enabled = false;
|
||||
$avatar_drivers = null;
|
||||
$avatar_data = null;
|
||||
|
|
|
@ -30,7 +30,7 @@ class ucp_profile
|
|||
{
|
||||
global $cache, $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
|
||||
global $request;
|
||||
global $phpbb_avatar_manager;
|
||||
global $phpbb_container;
|
||||
|
||||
$user->add_lang('posting');
|
||||
|
||||
|
@ -549,6 +549,7 @@ class ucp_profile
|
|||
|
||||
add_form_key('ucp_avatar');
|
||||
|
||||
$phpbb_avatar_manager = $phpbb_container->get('avatar.manager');
|
||||
$avatars_enabled = false;
|
||||
|
||||
if ($config['allow_avatar'] && $auth->acl_get('u_chgavatar'))
|
||||
|
|
Loading…
Add table
Reference in a new issue