diff options
author | Marc Alexander <admin@m-a-styles.de> | 2012-11-18 23:09:09 +0100 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2012-11-18 23:09:09 +0100 |
commit | 959bc183bf21e77c694ac0b68cbda5b93ae79cd0 (patch) | |
tree | dbfa092cf102529d15565e82a920276ea58b222d /phpBB | |
parent | d8510356d6a0f838017ae94bec1a5ed8254432da (diff) | |
download | forums-959bc183bf21e77c694ac0b68cbda5b93ae79cd0.tar forums-959bc183bf21e77c694ac0b68cbda5b93ae79cd0.tar.gz forums-959bc183bf21e77c694ac0b68cbda5b93ae79cd0.tar.bz2 forums-959bc183bf21e77c694ac0b68cbda5b93ae79cd0.tar.xz forums-959bc183bf21e77c694ac0b68cbda5b93ae79cd0.zip |
[feature/avatars] Handle deletion of avatars
Previously this wasn't handled correctly if at all.
PHPBB3-10018
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/adm/style/acp_groups.html | 1 | ||||
-rw-r--r-- | phpBB/adm/style/acp_users_avatar.html | 1 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_groups.php | 8 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_users.php | 8 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_profile.php | 4 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/ucp_avatar_options.html | 1 |
6 files changed, 19 insertions, 4 deletions
diff --git a/phpBB/adm/style/acp_groups.html b/phpBB/adm/style/acp_groups.html index d062064fe9..b38d61bef3 100644 --- a/phpBB/adm/style/acp_groups.html +++ b/phpBB/adm/style/acp_groups.html @@ -105,6 +105,7 @@ <dl> <dt><label>{L_CURRENT_IMAGE}{L_COLON}</label><br /><span>{L_AVATAR_EXPLAIN}</span></dt> <dd>{AVATAR}</dd> + <dd><label for="av_delete"><input type="checkbox" name="av_delete" id="av_delete" /> {L_DELETE_AVATAR}</label></dd> </dl> <dl> <dt><label>{L_AVATAR_TYPE}{L_COLON}</label></dt> diff --git a/phpBB/adm/style/acp_users_avatar.html b/phpBB/adm/style/acp_users_avatar.html index 069f7f6e50..e32d8f379b 100644 --- a/phpBB/adm/style/acp_users_avatar.html +++ b/phpBB/adm/style/acp_users_avatar.html @@ -6,6 +6,7 @@ <dl> <dt><label>{L_CURRENT_IMAGE}{L_COLON}</label><br /><span>{L_AVATAR_EXPLAIN}</span></dt> <dd>{AVATAR}</dd> + <dd><label for="av_delete"><input type="checkbox" name="av_delete" id="av_delete" /> {L_DELETE_AVATAR}</label></dd> </dl> </fieldset> <fieldset> diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php index 7be58b6df1..f461555056 100644 --- a/phpBB/includes/acp/acp_groups.php +++ b/phpBB/includes/acp/acp_groups.php @@ -335,7 +335,8 @@ class acp_groups // Handle avatar $driver = str_replace('_', '.', request_var('avatar_driver', '')); $config_name = preg_replace('#^avatar.driver.#', '', $driver); - if (in_array($driver, $avatar_drivers) && $config["allow_avatar_$config_name"]) + $av_delete = $request->variable('av_delete', ''); + if (in_array($driver, $avatar_drivers) && $config["allow_avatar_$config_name"] && empty($av_delete)) { $avatar = $phpbb_avatar_manager->get_driver($driver); $result = $avatar->process_form($template, $avatar_data, $avatar_error); @@ -354,6 +355,11 @@ class acp_groups } else { + if ($avatar = $phpbb_avatar_manager->get_driver($user->data['user_avatar_type'])) + { + $avatar->delete($avatar_data); + } + // Removing the avatar $submit_ary['avatar_type'] = ''; $submit_ary['avatar'] = ''; diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 562353b229..fdad1df0fd 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1746,7 +1746,8 @@ class acp_users { $driver = str_replace('_', '.', request_var('avatar_driver', '')); $config_name = preg_replace('#^avatar.driver.#', '', $driver); - if (in_array($driver, $avatar_drivers) && $config["allow_avatar_$config_name"]) + $av_delete = $request->variable('av_delete', ''); + if (in_array($driver, $avatar_drivers) && $config["allow_avatar_$config_name"] && empty($av_delete)) { $avatar = $phpbb_avatar_manager->get_driver($driver); $result = $avatar->process_form($template, $avatar_data, $error); @@ -1770,6 +1771,11 @@ class acp_users } else { + if ($avatar = $phpbb_avatar_manager->get_driver($user->data['user_avatar_type'])) + { + $avatar->delete($avatar_data); + } + // Removing the avatar $result = array( 'user_avatar' => '', diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index 6a1ad33ceb..77b2dc7054 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -565,7 +565,8 @@ class ucp_profile { $driver = str_replace('_', '.', request_var('avatar_driver', '')); $config_name = preg_replace('#^avatar.driver.#', '', $driver); - if (in_array($driver, $avatar_drivers) && $config["allow_avatar_$config_name"]) + $av_delete = $request->variable('av_delete', ''); + if (in_array($driver, $avatar_drivers) && $config["allow_avatar_$config_name"] && empty($av_delete)) { $avatar = $phpbb_avatar_manager->get_driver($driver); $result = $avatar->process_form($template, $avatar_data, $error); @@ -593,7 +594,6 @@ class ucp_profile } else { - // They are removing their avatar or are trying to play games with us if ($avatar = $phpbb_avatar_manager->get_driver($user->data['user_avatar_type'])) { $avatar->delete($avatar_data); diff --git a/phpBB/styles/prosilver/template/ucp_avatar_options.html b/phpBB/styles/prosilver/template/ucp_avatar_options.html index bca957043b..e7300a075d 100644 --- a/phpBB/styles/prosilver/template/ucp_avatar_options.html +++ b/phpBB/styles/prosilver/template/ucp_avatar_options.html @@ -9,6 +9,7 @@ <dl> <dt><label>{L_CURRENT_IMAGE}{L_COLON}</label><br /><span>{L_AVATAR_EXPLAIN}</span></dt> <dd><!-- IF AVATAR -->{AVATAR}<!-- ELSE --><img src="{T_THEME_PATH}/images/no_avatar.gif" alt="" /><!-- ENDIF --></dd> + <dd><label for="av_delete"><input type="checkbox" name="av_delete" id="av_delete" /> {L_DELETE_AVATAR}</label></dd> </dl> </fieldset> <h3>{L_AVATAR_SELECT}</h3> |