Move avatar actions to controller AvatarFile
This commit is contained in:
@@ -14,9 +14,46 @@ 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);
|
||||
|
||||
Reference in New Issue
Block a user