diff options
| author | Cullen Walsh <ckwalsh@phpbb.com> | 2011-04-20 23:14:38 -0700 |
|---|---|---|
| committer | Cullen Walsh <ckwalsh@cullenwalsh.com> | 2012-03-18 22:20:45 +0000 |
| commit | 84099e5bc1f452e1a4643fd78658929875ab1eee (patch) | |
| tree | f89caba7c98587128009218f37f50630d585e83b /phpBB/includes/avatar | |
| parent | 611a1d647a3a63013df472b469bf1f3e6e7bd657 (diff) | |
| download | forums-84099e5bc1f452e1a4643fd78658929875ab1eee.tar forums-84099e5bc1f452e1a4643fd78658929875ab1eee.tar.gz forums-84099e5bc1f452e1a4643fd78658929875ab1eee.tar.bz2 forums-84099e5bc1f452e1a4643fd78658929875ab1eee.tar.xz forums-84099e5bc1f452e1a4643fd78658929875ab1eee.zip | |
[feature/avatars] Support proper avatar deletion, stub ACP
Fixing avatar deletion in the UCP and ACP, and stubbing the ACP
configuration page. I'll admit I kind of got caught carried away, so
this really should be a couple separate commits.
PHPBB3-10018
Diffstat (limited to 'phpBB/includes/avatar')
| -rw-r--r-- | phpBB/includes/avatar/driver.php | 8 | ||||
| -rw-r--r-- | phpBB/includes/avatar/driver/upload.php | 16 | ||||
| -rw-r--r-- | phpBB/includes/avatar/manager.php | 14 |
3 files changed, 38 insertions, 0 deletions
diff --git a/phpBB/includes/avatar/driver.php b/phpBB/includes/avatar/driver.php index 5d3b734f7b..5322f73c60 100644 --- a/phpBB/includes/avatar/driver.php +++ b/phpBB/includes/avatar/driver.php @@ -114,4 +114,12 @@ abstract class phpbb_avatar_driver { return false; } + + /** + * @TODO + **/ + public function delete($user_row) + { + return true; + } } diff --git a/phpBB/includes/avatar/driver/upload.php b/phpBB/includes/avatar/driver/upload.php index dd1dbfa5a0..5b487745b1 100644 --- a/phpBB/includes/avatar/driver/upload.php +++ b/phpBB/includes/avatar/driver/upload.php @@ -122,6 +122,22 @@ class phpbb_avatar_driver_upload extends phpbb_avatar_driver } /** + * @inheritdoc + */ + public function delete($user_row) + { + $ext = substr(strrchr($user_row['user_avatar'], '.'), 1); + $filename = $this->phpbb_root_path . $this->config['avatar_path'] . '/' . $this->config['avatar_salt'] . '_' . $user_row['user_id'] . '.' . $ext; + + if (file_exists($filename)) + { + @unlink($filename); + } + + return true; + } + + /** * @TODO */ private function can_upload() diff --git a/phpBB/includes/avatar/manager.php b/phpBB/includes/avatar/manager.php index 6471c4cc9c..7137243898 100644 --- a/phpBB/includes/avatar/manager.php +++ b/phpBB/includes/avatar/manager.php @@ -47,6 +47,20 @@ class phpbb_avatar_manager $this->load_valid_drivers(); } + // Legacy stuff... + switch ($avatar_type) + { + case AVATAR_LOCAL: + $avatar_type = 'local'; + break; + case AVATAR_UPLOAD: + $avatar_type = 'upload'; + break; + case AVATAR_REMOTE: + $avatar_type = 'remote'; + break; + } + if (isset(self::$valid_drivers[$avatar_type])) { if ($new || !is_object(self::$valid_drivers[$avatar_type])) |
