aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/includes/acp/acp_groups.php14
-rw-r--r--phpBB/includes/acp/acp_users.php12
-rw-r--r--phpBB/includes/avatar/driver/gravatar.php5
-rw-r--r--phpBB/includes/avatar/driver/remote.php2
-rw-r--r--phpBB/includes/ucp/ucp_groups.php2
-rw-r--r--phpBB/includes/ucp/ucp_profile.php2
-rw-r--r--phpBB/install/database_update.php20
7 files changed, 30 insertions, 27 deletions
diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php
index 3a49ac8ff8..7a66f993b0 100644
--- a/phpBB/includes/acp/acp_groups.php
+++ b/phpBB/includes/acp/acp_groups.php
@@ -334,7 +334,7 @@ class acp_groups
{
// Handle avatar
$driver = str_replace('_', '.', request_var('avatar_driver', ''));
- $config_name = preg_replace('#^avatar.driver.#', '', $driver);
+ $config_name = preg_replace('#^avatar\.driver.#', '', $driver);
$avatar_delete = $request->variable('avatar_delete', '');
if (in_array($driver, $avatar_drivers) && $config["allow_avatar_$config_name"] && empty($avatar_delete))
{
@@ -534,7 +534,7 @@ class acp_groups
if ($avatar->is_enabled())
{
$avatars_enabled = true;
- $config_name = preg_replace('#^avatar.driver.#', '', $driver);
+ $config_name = preg_replace('#^avatar\.driver.#', '', $driver);
$template->set_filenames(array(
'avatar' => "acp_avatar_options_$config_name.html",
));
@@ -558,8 +558,10 @@ class acp_groups
$avatar = get_group_avatar($group_row, 'GROUP_AVATAR', true);
- // Merge any avatars errors into the primary error array
- // Drivers use lang constants, so we need to map to the actual strings
+ /*
+ * Merge any avatar errors into the primary error array
+ * Drivers use language constants, so we need to map to the actual strings
+ */
foreach ($avatar_error as $e)
{
if (is_array($e))
@@ -569,7 +571,7 @@ class acp_groups
}
else
{
- $error[] = $user->lang((string) $e);
+ $error[] = $user->lang("$e");
}
}
@@ -615,7 +617,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' => (empty($avatar) ? '<img src="' . $phpbb_admin_path . 'images/no_avatar.gif" alt="" />' : $avatar),
+ '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'] : '',
diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php
index 2f7662982a..8e194dc91d 100644
--- a/phpBB/includes/acp/acp_users.php
+++ b/phpBB/includes/acp/acp_users.php
@@ -454,7 +454,7 @@ class acp_users
{
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&amp;u=' . $user_id), E_USER_WARNING);
}
-
+
$sql_ary = array(
'user_avatar' => '',
'user_avatar_type' => '',
@@ -1745,7 +1745,7 @@ class acp_users
if (check_form_key($form_name))
{
$driver = str_replace('_', '.', request_var('avatar_driver', ''));
- $config_name = preg_replace('#^avatar.driver.#', '', $driver);
+ $config_name = preg_replace('#^avatar\.driver.#', '', $driver);
$avatar_delete = $request->variable('avatar_delete', '');
if (in_array($driver, $avatar_drivers) && $config["allow_avatar_$config_name"] && empty($avatar_delete))
{
@@ -1761,6 +1761,7 @@ class acp_users
'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 = ' . $user_id;
@@ -1771,7 +1772,8 @@ class acp_users
}
else
{
- if ($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);
}
@@ -1786,7 +1788,7 @@ class acp_users
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $result) . '
- WHERE user_id = ' . $user_id;
+ WHERE user_id = ' . (int) $user_id;
$db->sql_query($sql);
trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&amp;u=' . $user_id));
@@ -1807,7 +1809,7 @@ class acp_users
if ($avatar->is_enabled())
{
$avatars_enabled = true;
- $config_name = preg_replace('#^avatar.driver.#', '', $driver);
+ $config_name = preg_replace('#^avatar\.driver.#', '', $driver);
$template->set_filenames(array(
'avatar' => "acp_avatar_options_$config_name.html",
));
diff --git a/phpBB/includes/avatar/driver/gravatar.php b/phpBB/includes/avatar/driver/gravatar.php
index d873f7ba41..cca7289275 100644
--- a/phpBB/includes/avatar/driver/gravatar.php
+++ b/phpBB/includes/avatar/driver/gravatar.php
@@ -56,11 +56,10 @@ class phpbb_avatar_driver_gravatar extends phpbb_avatar_driver
*/
public function get_custom_html($row, $ignore_config = false, $alt = '')
{
- $html = '<img src="' . $this->get_gravatar_url($row) . '" ' .
+ return '<img src="' . $this->get_gravatar_url($row) . '" ' .
($row['avatar_width'] ? ('width="' . $row['avatar_width'] . '" ') : '') .
($row['avatar_height'] ? ('height="' . $row['avatar_height'] . '" ') : '') .
'alt="' . ((!empty($user->lang[$alt])) ? $user->lang[$alt] : $alt) . '" />';
- return $html;
}
/**
@@ -121,7 +120,7 @@ class phpbb_avatar_driver_gravatar extends phpbb_avatar_driver
$row['avatar_width'] = $row['avatar_height'] = min($this->config['avatar_max_width'], $this->config['avatar_max_height']);
$url = $this->get_gravatar_url($row);
- if (($row['avatar_width'] <= 0 || $row['avatar_height'] <= 0) && (($image_data = @getimagesize($url)) === false))
+ if (($row['avatar_width'] <= 0 || $row['avatar_height'] <= 0) && (($image_data = getimagesize($url)) === false))
{
$error[] = 'UNABLE_GET_IMAGE_SIZE';
return false;
diff --git a/phpBB/includes/avatar/driver/remote.php b/phpBB/includes/avatar/driver/remote.php
index c2ae88cc02..f47b0d33f4 100644
--- a/phpBB/includes/avatar/driver/remote.php
+++ b/phpBB/includes/avatar/driver/remote.php
@@ -106,7 +106,7 @@ class phpbb_avatar_driver_remote extends phpbb_avatar_driver
// Make sure getimagesize works...
if (function_exists('getimagesize'))
{
- if (($width <= 0 || $height <= 0) && (($image_data = @getimagesize($url)) === false))
+ if (($width <= 0 || $height <= 0) && (($image_data = getimagesize($url)) === false))
{
$error[] = 'UNABLE_GET_IMAGE_SIZE';
return false;
diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php
index 2a388d17f8..5289a95e6d 100644
--- a/phpBB/includes/ucp/ucp_groups.php
+++ b/phpBB/includes/ucp/ucp_groups.php
@@ -521,7 +521,7 @@ class ucp_groups
{
// Handle avatar
$driver = str_replace('_', '.', request_var('avatar_driver', ''));
- $config_name = preg_replace('#^avatar.driver.#', '', $driver);
+ $config_name = preg_replace('#^avatar\.driver.#', '', $driver);
$avatar_delete = $request->variable('avatar_delete', '');
if (in_array($driver, $avatar_drivers) && $config["allow_avatar_$config_name"] && empty($avatar_delete))
{
diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php
index ab49a11f99..402db86c1d 100644
--- a/phpBB/includes/ucp/ucp_profile.php
+++ b/phpBB/includes/ucp/ucp_profile.php
@@ -564,7 +564,7 @@ class ucp_profile
if (check_form_key('ucp_avatar'))
{
$driver = str_replace('_', '.', request_var('avatar_driver', ''));
- $config_name = preg_replace('#^avatar.driver.#', '', $driver);
+ $config_name = preg_replace('#^avatar\.driver.#', '', $driver);
$avatar_delete = $request->variable('avatar_delete', '');
if (in_array($driver, $avatar_drivers) && $config["allow_avatar_$config_name"] && empty($avatar_delete))
{
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index d471833442..b27613168f 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -2722,27 +2722,27 @@ function change_database_data(&$no_updates, $version)
foreach ($avatar_type_map as $old => $new)
{
$sql = 'UPDATE ' . USERS_TABLE . "
- SET user_avatar_type = '" . $db->sql_escape($new) . "'
- WHERE user_avatar_type = '" . $db->sql_escape($old) . "'";
+ SET user_avatar_type = '" . $new . "'
+ WHERE user_avatar_type = '" . $old . "'";
_sql($sql, $errored, $error_ary);
$sql = 'UPDATE ' . GROUPS_TABLE . "
- SET group_avatar_type = '" . $db->sql_escape($new) . "'
- WHERE group_avatar_type = '" . $db->sql_escape($old) . "'";
+ SET group_avatar_type = '" . $new . "'
+ WHERE group_avatar_type = '" . $old . "'";
_sql($sql, $errored, $error_ary);
}
// update avatar module_auth
- $sql = 'UPDATE ' . MODULES_TABLE . '
- SET module_auth = \'cfg_allow_avatar && (cfg_allow_avatar_local || cfg_allow_avatar_remote || cfg_allow_avatar_upload || cfg_allow_avatar_remote_upload || cfg_allow_avatar_gravatar)\'
- WHERE module_class = \'ucp\'
- AND module_basename = \'ucp_profile\'
- AND module_mode = \'avatar\'';
+ $sql = 'UPDATE ' . MODULES_TABLE . "
+ SET module_auth = 'cfg_allow_avatar && (cfg_allow_avatar_local || cfg_allow_avatar_remote || cfg_allow_avatar_upload || cfg_allow_avatar_remote_upload || cfg_allow_avatar_gravatar)'
+ WHERE module_class = 'ucp'
+ AND module_basename = 'ucp_profile'
+ AND module_mode = 'avatar'";
_sql($sql, $errored, $error_ary);
if (!isset($config['allow_avatar_gravatar']))
{
- $config->set('allow_avatar_gravatar', '');
+ $config->set('allow_avatar_gravatar', '0');
}
$no_updates = false;