summaryrefslogtreecommitdiff
path: root/app/Controller
diff options
context:
space:
mode:
Diffstat (limited to 'app/Controller')
-rw-r--r--app/Controller/AvatarFile.php39
-rw-r--r--app/Controller/User.php37
2 files changed, 38 insertions, 38 deletions
diff --git a/app/Controller/AvatarFile.php b/app/Controller/AvatarFile.php
index f8298e16..a47cca66 100644
--- a/app/Controller/AvatarFile.php
+++ b/app/Controller/AvatarFile.php
@@ -14,10 +14,47 @@ use Kanboard\Core\Thumbnail;
class AvatarFile extends Base
{
/**
- * Show Avatar image and send aggressive caching headers
+ * Display avatar page
*/
public function show()
{
+ $user = $this->getUser();
+
+ $this->response->html($this->helper->layout->user('avatar_file/show', array(
+ 'user' => $user,
+ )));
+ }
+
+ /**
+ * Upload Avatar
+ */
+ public function upload()
+ {
+ $user = $this->getUser();
+
+ if (! $this->avatarFile->uploadFile($user['id'], $this->request->getFileInfo('avatar'))) {
+ $this->flash->failure(t('Unable to upload the file.'));
+ }
+
+ $this->response->redirect($this->helper->url->to('AvatarFile', 'show', array('user_id' => $user['id'])));
+ }
+
+ /**
+ * Remove Avatar image
+ */
+ public function remove()
+ {
+ $this->checkCSRFParam();
+ $user = $this->getUser();
+ $this->avatarFile->remove($user['id']);
+ $this->response->redirect($this->helper->url->to('AvatarFile', 'show', array('user_id' => $user['id'])));
+ }
+
+ /**
+ * Show Avatar image (public)
+ */
+ public function image()
+ {
$user_id = $this->request->getIntegerParam('user_id');
$size = $this->request->getStringParam('size', 48);
$filename = $this->avatarFile->getFilename($user_id);
diff --git a/app/Controller/User.php b/app/Controller/User.php
index 8c02ef7f..f7d7d2e0 100644
--- a/app/Controller/User.php
+++ b/app/Controller/User.php
@@ -405,41 +405,4 @@ class User extends Base
'user' => $user,
)));
}
-
- /**
- * Display avatar page
- */
- public function avatar()
- {
- $user = $this->getUser();
-
- $this->response->html($this->helper->layout->user('user/avatar', array(
- 'user' => $user,
- )));
- }
-
- /**
- * Upload Avatar
- */
- public function uploadAvatar()
- {
- $user = $this->getUser();
-
- if (! $this->avatarFile->uploadFile($user['id'], $this->request->getFileInfo('avatar'))) {
- $this->flash->failure(t('Unable to upload the file.'));
- }
-
- $this->response->redirect($this->helper->url->to('user', 'avatar', array('user_id' => $user['id'])));
- }
-
- /**
- * Remove Avatar image
- */
- public function removeAvatar()
- {
- $this->checkCSRFParam();
- $user = $this->getUser();
- $this->avatarFile->remove($user['id']);
- $this->response->redirect($this->helper->url->to('user', 'avatar', array('user_id' => $user['id'])));
- }
}