mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-08 17:56:52 +02:00
Merge remote-tracking branch 'remotes/marc/feature/avatars' into develop
# By Marc Alexander (100) and others # Via Marc Alexander (8) and Igor Wiedler (3) * remotes/marc/feature/avatars: (138 commits) [feature/avatars] Update module_auth of ucp module and fix small issues [feature/avatars] Add migrations data file for avatars [feature/avatars] Reduce module auth of ucp avatar settings [feature/avatars] Auto-clear avatar dimensions when first changing avatars [feature/avatars] Use "Main" as category for avatars in root of gallery [feature/avatars] Remove trailing whitespace from avatar code [feature/avatars] Pass phpbb_user to prepare and process form functions [feature/avatars] Document the use of the allowed extensions array [feature/avatars] Use array for allowed extensions and implode if needed [feature/avatars] Use deprecated for compatibility function [feature/avatars] Correct license, copyright and package info [feature/avatars] Move list of supported formats to avatar driver class [feature/avatars] Add include of functions_display.php in BC function [feature/avatars] Add note about when compatibility function was added [feature/avatars] Add compatibility function for get_user_avatar() [feature/avatars] Move definition of driver_collection to avatars.yml [feature/avatars] Remove the obsolete request argument for avatar drivers [feature/avatars] Add missing @var to docblocks in avatar manager [feature/avatars] Remove not needed inline style [feature/avatars] Differentiate tests for get drivers functions ...
This commit is contained in:
@@ -28,7 +28,7 @@ class acp_board
|
||||
{
|
||||
global $db, $user, $auth, $template;
|
||||
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||
global $cache;
|
||||
global $cache, $phpbb_container;
|
||||
|
||||
$user->add_lang('acp/board');
|
||||
|
||||
@@ -107,6 +107,23 @@ class acp_board
|
||||
break;
|
||||
|
||||
case 'avatar':
|
||||
$phpbb_avatar_manager = $phpbb_container->get('avatar.manager');
|
||||
$avatar_drivers = $phpbb_avatar_manager->get_all_drivers();
|
||||
|
||||
$avatar_vars = array();
|
||||
foreach ($avatar_drivers as $current_driver)
|
||||
{
|
||||
$driver = $phpbb_avatar_manager->get_driver($current_driver, false);
|
||||
|
||||
/*
|
||||
* First grab the settings for enabling/disabling the avatar
|
||||
* driver and afterwards grab additional settings the driver
|
||||
* might have.
|
||||
*/
|
||||
$avatar_vars += $phpbb_avatar_manager->get_avatar_settings($driver);
|
||||
$avatar_vars += $driver->prepare_form_acp($user);
|
||||
}
|
||||
|
||||
$display_vars = array(
|
||||
'title' => 'ACP_AVATAR_SETTINGS',
|
||||
'vars' => array(
|
||||
@@ -118,17 +135,15 @@ class acp_board
|
||||
'avatar_max_height' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false),
|
||||
|
||||
'allow_avatar' => array('lang' => 'ALLOW_AVATARS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'allow_avatar_local' => array('lang' => 'ALLOW_LOCAL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
'allow_avatar_remote' => array('lang' => 'ALLOW_REMOTE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'allow_avatar_upload' => array('lang' => 'ALLOW_UPLOAD', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
'allow_avatar_remote_upload'=> array('lang' => 'ALLOW_REMOTE_UPLOAD', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'avatar_filesize' => array('lang' => 'MAX_FILESIZE', 'validate' => 'int:0', 'type' => 'text:4:10', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']),
|
||||
'avatar_min' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
|
||||
'avatar_max' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
|
||||
'avatar_path' => array('lang' => 'AVATAR_STORAGE_PATH', 'validate' => 'rwpath', 'type' => 'text:20:255', 'explain' => true),
|
||||
'avatar_gallery_path' => array('lang' => 'AVATAR_GALLERY_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true),
|
||||
)
|
||||
);
|
||||
|
||||
if (!empty($avatar_vars))
|
||||
{
|
||||
$display_vars['vars'] += $avatar_vars;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'message':
|
||||
|
@@ -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;
|
||||
global $request, $phpbb_container;
|
||||
|
||||
$user->add_lang('acp/groups');
|
||||
$this->tpl_name = 'acp_groups';
|
||||
@@ -55,7 +55,6 @@ class acp_groups
|
||||
|
||||
|
||||
// Clear some vars
|
||||
$can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && phpbb_is_writable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false;
|
||||
$group_row = array();
|
||||
|
||||
// Grab basic data for group, if group_id is set and exists
|
||||
@@ -302,8 +301,21 @@ class acp_groups
|
||||
$error = array();
|
||||
$user->add_lang('ucp');
|
||||
|
||||
$avatar_select = basename(request_var('avatar_select', ''));
|
||||
$category = basename(request_var('category', ''));
|
||||
// Setup avatar data for later
|
||||
$avatars_enabled = false;
|
||||
$avatar_drivers = null;
|
||||
$avatar_data = null;
|
||||
$avatar_error = array();
|
||||
|
||||
if ($config['allow_avatar'])
|
||||
{
|
||||
$phpbb_avatar_manager = $phpbb_container->get('avatar.manager');
|
||||
$avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers();
|
||||
|
||||
// This is normalised data, without the group_ prefix
|
||||
$avatar_data = phpbb_avatar_manager::clean_row($group_row);
|
||||
}
|
||||
|
||||
|
||||
// Did we submit?
|
||||
if ($update)
|
||||
@@ -321,12 +333,6 @@ class acp_groups
|
||||
$allow_desc_urls = request_var('desc_parse_urls', false);
|
||||
$allow_desc_smilies = request_var('desc_parse_smilies', false);
|
||||
|
||||
$data['uploadurl'] = request_var('uploadurl', '');
|
||||
$data['remotelink'] = request_var('remotelink', '');
|
||||
$data['width'] = request_var('width', '');
|
||||
$data['height'] = request_var('height', '');
|
||||
$delete = request_var('delete', '');
|
||||
|
||||
$submit_ary = array(
|
||||
'colour' => request_var('group_colour', ''),
|
||||
'rank' => request_var('group_rank', 0),
|
||||
@@ -344,81 +350,35 @@ class acp_groups
|
||||
$submit_ary['founder_manage'] = isset($_REQUEST['group_founder_manage']) ? 1 : 0;
|
||||
}
|
||||
|
||||
$uploadfile = $request->file('uploadfile');
|
||||
if (!empty($uploadfile['tmp_name']) || $data['uploadurl'] || $data['remotelink'])
|
||||
if ($config['allow_avatar'])
|
||||
{
|
||||
// Avatar stuff
|
||||
$var_ary = array(
|
||||
'uploadurl' => array('string', true, 5, 255),
|
||||
'remotelink' => array('string', true, 5, 255),
|
||||
'width' => array('string', true, 1, 3),
|
||||
'height' => array('string', true, 1, 3),
|
||||
);
|
||||
// Handle avatar
|
||||
$driver_name = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', ''));
|
||||
|
||||
if (!($error = validate_data($data, $var_ary)))
|
||||
if (in_array($driver_name, $avatar_drivers) && !$request->is_set_post('avatar_delete'))
|
||||
{
|
||||
$data['user_id'] = "g$group_id";
|
||||
$driver = $phpbb_avatar_manager->get_driver($driver_name);
|
||||
$result = $driver->process_form($request, $template, $user, $avatar_data, $avatar_error);
|
||||
|
||||
if ((!empty($uploadfile['tmp_name']) || $data['uploadurl']) && $can_upload)
|
||||
if ($result && empty($avatar_error))
|
||||
{
|
||||
list($submit_ary['avatar_type'], $submit_ary['avatar'], $submit_ary['avatar_width'], $submit_ary['avatar_height']) = avatar_upload($data, $error);
|
||||
}
|
||||
else if ($data['remotelink'])
|
||||
{
|
||||
list($submit_ary['avatar_type'], $submit_ary['avatar'], $submit_ary['avatar_width'], $submit_ary['avatar_height']) = avatar_remote($data, $error);
|
||||
$result['avatar_type'] = $driver_name;
|
||||
$submit_ary = array_merge($submit_ary, $result);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ($avatar_select && $config['allow_avatar_local'])
|
||||
{
|
||||
// check avatar gallery
|
||||
if (is_dir($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category))
|
||||
else
|
||||
{
|
||||
$submit_ary['avatar_type'] = AVATAR_GALLERY;
|
||||
|
||||
list($submit_ary['avatar_width'], $submit_ary['avatar_height']) = getimagesize($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category . '/' . $avatar_select);
|
||||
$submit_ary['avatar'] = $category . '/' . $avatar_select;
|
||||
}
|
||||
}
|
||||
else if ($delete)
|
||||
{
|
||||
$submit_ary['avatar'] = '';
|
||||
$submit_ary['avatar_type'] = $submit_ary['avatar_width'] = $submit_ary['avatar_height'] = 0;
|
||||
}
|
||||
else if ($data['width'] && $data['height'])
|
||||
{
|
||||
// Only update the dimensions?
|
||||
if ($config['avatar_max_width'] || $config['avatar_max_height'])
|
||||
{
|
||||
if ($data['width'] > $config['avatar_max_width'] || $data['height'] > $config['avatar_max_height'])
|
||||
$driver = $phpbb_avatar_manager->get_driver($user->data['user_avatar_type']);
|
||||
if ($driver)
|
||||
{
|
||||
$error[] = phpbb_avatar_error_wrong_size($data['width'], $data['height']);
|
||||
$driver->delete($avatar_data);
|
||||
}
|
||||
}
|
||||
|
||||
if (!sizeof($error))
|
||||
{
|
||||
if ($config['avatar_min_width'] || $config['avatar_min_height'])
|
||||
{
|
||||
if ($data['width'] < $config['avatar_min_width'] || $data['height'] < $config['avatar_min_height'])
|
||||
{
|
||||
$error[] = phpbb_avatar_error_wrong_size($data['width'], $data['height']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!sizeof($error))
|
||||
{
|
||||
$submit_ary['avatar_width'] = $data['width'];
|
||||
$submit_ary['avatar_height'] = $data['height'];
|
||||
}
|
||||
}
|
||||
|
||||
if ((isset($submit_ary['avatar']) && $submit_ary['avatar'] && (!isset($group_row['group_avatar']))) || $delete)
|
||||
{
|
||||
if (isset($group_row['group_avatar']) && $group_row['group_avatar'])
|
||||
{
|
||||
avatar_delete('group', $group_row, true);
|
||||
// Removing the avatar
|
||||
$submit_ary['avatar_type'] = '';
|
||||
$submit_ary['avatar'] = '';
|
||||
$submit_ary['avatar_width'] = 0;
|
||||
$submit_ary['avatar_height'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -445,7 +405,7 @@ class acp_groups
|
||||
'rank' => 'int',
|
||||
'colour' => 'string',
|
||||
'avatar' => 'string',
|
||||
'avatar_type' => 'int',
|
||||
'avatar_type' => 'string',
|
||||
'avatar_width' => 'int',
|
||||
'avatar_height' => 'int',
|
||||
'receive_pm' => 'int',
|
||||
@@ -575,15 +535,43 @@ class acp_groups
|
||||
$type_closed = ($group_type == GROUP_CLOSED) ? ' checked="checked"' : '';
|
||||
$type_hidden = ($group_type == GROUP_HIDDEN) ? ' checked="checked"' : '';
|
||||
|
||||
$avatar_img = (!empty($group_row['group_avatar'])) ? get_user_avatar($group_row['group_avatar'], $group_row['group_avatar_type'], $group_row['group_avatar_width'], $group_row['group_avatar_height'], 'GROUP_AVATAR') : '<img src="' . $phpbb_admin_path . 'images/no_avatar.gif" alt="" />';
|
||||
|
||||
$display_gallery = (isset($_POST['display_gallery'])) ? true : false;
|
||||
|
||||
if ($config['allow_avatar_local'] && $display_gallery)
|
||||
// Load up stuff for avatars
|
||||
if ($config['allow_avatar'])
|
||||
{
|
||||
avatar_gallery($category, $avatar_select, 4);
|
||||
$avatars_enabled = false;
|
||||
$selected_driver = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', $avatar_data['avatar_type']));
|
||||
|
||||
foreach ($avatar_drivers as $current_driver)
|
||||
{
|
||||
$driver = $phpbb_avatar_manager->get_driver($current_driver);
|
||||
|
||||
$avatars_enabled = true;
|
||||
$config_name = $phpbb_avatar_manager->get_driver_config_name($driver);
|
||||
$template->set_filenames(array(
|
||||
'avatar' => "acp_avatar_options_{$config_name}.html",
|
||||
));
|
||||
|
||||
if ($driver->prepare_form($request, $template, $user, $avatar_data, $avatar_error))
|
||||
{
|
||||
$driver_name = $phpbb_avatar_manager->prepare_driver_name($current_driver);
|
||||
$driver_upper = strtoupper($driver_name);
|
||||
$template->assign_block_vars('avatar_drivers', array(
|
||||
'L_TITLE' => $user->lang($driver_upper . '_TITLE'),
|
||||
'L_EXPLAIN' => $user->lang($driver_upper . '_EXPLAIN'),
|
||||
|
||||
'DRIVER' => $driver_name,
|
||||
'SELECTED' => $current_driver == $selected_driver,
|
||||
'OUTPUT' => $template->assign_display('avatar'),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$avatar = phpbb_get_group_avatar($group_row, 'GROUP_AVATAR', true);
|
||||
|
||||
// Merge any avatar errors into the primary error array
|
||||
$error = array_merge($error, $phpbb_avatar_manager->localize_errors($user, $avatar_error));
|
||||
|
||||
$back_link = request_var('back_link', '');
|
||||
|
||||
switch ($back_link)
|
||||
@@ -602,12 +590,10 @@ class acp_groups
|
||||
'S_ADD_GROUP' => ($action == 'add') ? true : false,
|
||||
'S_GROUP_PERM' => ($action == 'add' && $auth->acl_get('a_authgroups') && $auth->acl_gets('a_aauth', 'a_fauth', 'a_mauth', 'a_uauth')) ? true : false,
|
||||
'S_INCLUDE_SWATCH' => true,
|
||||
'S_CAN_UPLOAD' => $can_upload,
|
||||
'S_ERROR' => (sizeof($error)) ? true : false,
|
||||
'S_SPECIAL_GROUP' => ($group_type == GROUP_SPECIAL) ? true : false,
|
||||
'S_DISPLAY_GALLERY' => ($config['allow_avatar_local'] && !$display_gallery) ? true : false,
|
||||
'S_IN_GALLERY' => ($config['allow_avatar_local'] && $display_gallery) ? true : false,
|
||||
'S_USER_FOUNDER' => ($user->data['user_type'] == USER_FOUNDER) ? true : false,
|
||||
'S_AVATARS_ENABLED' => ($config['allow_avatar'] && $avatars_enabled),
|
||||
|
||||
'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '',
|
||||
'GROUP_NAME' => ($group_type == GROUP_SPECIAL) ? $user->lang['G_' . $group_name] : $group_name,
|
||||
@@ -628,8 +614,7 @@ class acp_groups
|
||||
|
||||
'S_RANK_OPTIONS' => $rank_options,
|
||||
'S_GROUP_OPTIONS' => group_select_options(false, false, (($user->data['user_type'] == USER_FOUNDER) ? false : 0)),
|
||||
'AVATAR' => $avatar_img,
|
||||
'AVATAR_IMAGE' => $avatar_img,
|
||||
'AVATAR' => empty($avatar) ? '<img src="' . $phpbb_admin_path . 'images/no_avatar.gif" alt="" />' : $avatar,
|
||||
'AVATAR_MAX_FILESIZE' => $config['avatar_filesize'],
|
||||
'AVATAR_WIDTH' => (isset($group_row['group_avatar_width'])) ? $group_row['group_avatar_width'] : '',
|
||||
'AVATAR_HEIGHT' => (isset($group_row['group_avatar_height'])) ? $group_row['group_avatar_height'] : '',
|
||||
|
@@ -33,6 +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_container;
|
||||
|
||||
$user->add_lang(array('posting', 'ucp', 'acp/users'));
|
||||
$this->tpl_name = 'acp_users';
|
||||
@@ -456,7 +457,7 @@ class acp_users
|
||||
|
||||
$sql_ary = array(
|
||||
'user_avatar' => '',
|
||||
'user_avatar_type' => 0,
|
||||
'user_avatar_type' => '',
|
||||
'user_avatar_width' => 0,
|
||||
'user_avatar_height' => 0,
|
||||
);
|
||||
@@ -467,9 +468,11 @@ class acp_users
|
||||
$db->sql_query($sql);
|
||||
|
||||
// Delete old avatar if present
|
||||
if ($user_row['user_avatar'] && $user_row['user_avatar_type'] != AVATAR_GALLERY)
|
||||
$phpbb_avatar_manager = $phpbb_container->get('avatar.manager');
|
||||
$driver = $phpbb_avatar_manager->get_driver($user_row['user_avatar_type']);
|
||||
if ($driver)
|
||||
{
|
||||
avatar_delete('user', $user_row);
|
||||
$driver->delete($user_row);
|
||||
}
|
||||
|
||||
add_log('admin', 'LOG_USER_DEL_AVATAR', $user_row['username']);
|
||||
@@ -1728,65 +1731,120 @@ class acp_users
|
||||
case 'avatar':
|
||||
|
||||
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
|
||||
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
|
||||
|
||||
$can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && phpbb_is_writable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false;
|
||||
$avatars_enabled = false;
|
||||
|
||||
if ($submit)
|
||||
if ($config['allow_avatar'])
|
||||
{
|
||||
$phpbb_avatar_manager = $phpbb_container->get('avatar.manager');
|
||||
$avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers();
|
||||
|
||||
if (!check_form_key($form_name))
|
||||
// This is normalised data, without the user_ prefix
|
||||
$avatar_data = phpbb_avatar_manager::clean_row($user_row);
|
||||
|
||||
if ($submit)
|
||||
{
|
||||
if (check_form_key($form_name))
|
||||
{
|
||||
$driver_name = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', ''));
|
||||
|
||||
if (in_array($driver_name, $avatar_drivers) && !$request->is_set_post('avatar_delete'))
|
||||
{
|
||||
$driver = $phpbb_avatar_manager->get_driver($driver_name);
|
||||
$result = $driver->process_form($request, $template, $user, $avatar_data, $error);
|
||||
|
||||
if ($result && empty($error))
|
||||
{
|
||||
// Success! Lets save the result in the database
|
||||
$result = array(
|
||||
'user_avatar_type' => $driver_name,
|
||||
'user_avatar' => $result['avatar'],
|
||||
'user_avatar_width' => $result['avatar_width'],
|
||||
'user_avatar_height' => $result['avatar_height'],
|
||||
);
|
||||
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $result) . '
|
||||
WHERE user_id = ' . (int) $user_id;
|
||||
|
||||
$db->sql_query($sql);
|
||||
trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$driver = $phpbb_avatar_manager->get_driver($user->data['user_avatar_type']);
|
||||
if ($driver)
|
||||
{
|
||||
$driver->delete($avatar_data);
|
||||
}
|
||||
|
||||
// Removing the avatar
|
||||
$result = array(
|
||||
'user_avatar' => '',
|
||||
'user_avatar_type' => '',
|
||||
'user_avatar_width' => 0,
|
||||
'user_avatar_height' => 0,
|
||||
);
|
||||
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $result) . '
|
||||
WHERE user_id = ' . (int) $user_id;
|
||||
|
||||
$db->sql_query($sql);
|
||||
trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
if (avatar_process_user($error, $user_row, $can_upload))
|
||||
$selected_driver = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', $user_row['user_avatar_type']));
|
||||
|
||||
foreach ($avatar_drivers as $current_driver)
|
||||
{
|
||||
trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_row['user_id']));
|
||||
$driver = $phpbb_avatar_manager->get_driver($current_driver);
|
||||
|
||||
$avatars_enabled = true;
|
||||
$config_name = $phpbb_avatar_manager->get_driver_config_name($driver);
|
||||
$template->set_filenames(array(
|
||||
'avatar' => "acp_avatar_options_{$config_name}.html",
|
||||
));
|
||||
|
||||
if ($driver->prepare_form($request, $template, $user, $avatar_data, $error))
|
||||
{
|
||||
$driver_name = $phpbb_avatar_manager->prepare_driver_name($current_driver);
|
||||
$driver_upper = strtoupper($driver_name);
|
||||
|
||||
$template->assign_block_vars('avatar_drivers', array(
|
||||
'L_TITLE' => $user->lang($driver_upper . '_TITLE'),
|
||||
'L_EXPLAIN' => $user->lang($driver_upper . '_EXPLAIN'),
|
||||
|
||||
'DRIVER' => $driver_name,
|
||||
'SELECTED' => $current_driver == $selected_driver,
|
||||
'OUTPUT' => $template->assign_display('avatar'),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
// Replace "error" strings with their real, localised form
|
||||
$error = array_map(array($user, 'lang'), $error);
|
||||
}
|
||||
|
||||
if (!$config['allow_avatar'] && $user_row['user_avatar_type'])
|
||||
{
|
||||
$error[] = $user->lang['USER_AVATAR_NOT_ALLOWED'];
|
||||
}
|
||||
else if ((($user_row['user_avatar_type'] == AVATAR_UPLOAD) && !$config['allow_avatar_upload']) ||
|
||||
(($user_row['user_avatar_type'] == AVATAR_REMOTE) && !$config['allow_avatar_remote']) ||
|
||||
(($user_row['user_avatar_type'] == AVATAR_GALLERY) && !$config['allow_avatar_local']))
|
||||
{
|
||||
$error[] = $user->lang['USER_AVATAR_TYPE_NOT_ALLOWED'];
|
||||
}
|
||||
// Replace "error" strings with their real, localised form
|
||||
$error = $phpbb_avatar_manager->localize_errors($user, $error);
|
||||
|
||||
// Generate users avatar
|
||||
$avatar_img = ($user_row['user_avatar']) ? get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height'], 'USER_AVATAR', true) : '<img src="' . $phpbb_admin_path . 'images/no_avatar.gif" alt="" />';
|
||||
|
||||
$display_gallery = (isset($_POST['display_gallery'])) ? true : false;
|
||||
$avatar_select = basename(request_var('avatar_select', ''));
|
||||
$category = basename(request_var('category', ''));
|
||||
|
||||
if ($config['allow_avatar_local'] && $display_gallery)
|
||||
{
|
||||
avatar_gallery($category, $avatar_select, 4);
|
||||
}
|
||||
$avatar = phpbb_get_user_avatar($user_row, 'USER_AVATAR', true);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_AVATAR' => true,
|
||||
'S_CAN_UPLOAD' => $can_upload,
|
||||
'S_UPLOAD_FILE' => ($config['allow_avatar'] && $can_upload && $config['allow_avatar_upload']) ? true : false,
|
||||
'S_REMOTE_UPLOAD' => ($config['allow_avatar'] && $can_upload && $config['allow_avatar_remote_upload']) ? true : false,
|
||||
'S_ALLOW_REMOTE' => ($config['allow_avatar'] && $config['allow_avatar_remote']) ? true : false,
|
||||
'S_DISPLAY_GALLERY' => ($config['allow_avatar'] && $config['allow_avatar_local'] && !$display_gallery) ? true : false,
|
||||
'S_IN_GALLERY' => ($config['allow_avatar'] && $config['allow_avatar_local'] && $display_gallery) ? true : false,
|
||||
'S_AVATAR' => true,
|
||||
'ERROR' => (!empty($error)) ? implode('<br />', $error) : '',
|
||||
'AVATAR' => (empty($avatar) ? '<img src="' . $phpbb_admin_path . 'images/no_avatar.gif" alt="" />' : $avatar),
|
||||
|
||||
'AVATAR_IMAGE' => $avatar_img,
|
||||
'AVATAR_MAX_FILESIZE' => $config['avatar_filesize'],
|
||||
'USER_AVATAR_WIDTH' => $user_row['user_avatar_width'],
|
||||
'USER_AVATAR_HEIGHT' => $user_row['user_avatar_height'],
|
||||
'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"',
|
||||
|
||||
'L_AVATAR_EXPLAIN' => phpbb_avatar_explanation_string(),
|
||||
'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024),
|
||||
|
||||
'S_AVATARS_ENABLED' => ($config['allow_avatar'] && $avatars_enabled),
|
||||
));
|
||||
|
||||
break;
|
||||
|
Reference in New Issue
Block a user