summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/avatar/controller.php12
-rw-r--r--lib/public/avatar.php12
2 files changed, 6 insertions, 18 deletions
diff --git a/core/avatar/controller.php b/core/avatar/controller.php
index 50ec50f19a5..d0edde50647 100644
--- a/core/avatar/controller.php
+++ b/core/avatar/controller.php
@@ -33,7 +33,7 @@ class OC_Core_Avatar_Controller {
if ($image instanceof \OC_Image) {
\OC_Response::setETagHeader(crc32($image->data()));
$image->show();
- } elseif ($image === false) {
+ } else {
\OC_JSON::success(array('user' => $user, 'size' => $size));
}
}
@@ -45,9 +45,7 @@ class OC_Core_Avatar_Controller {
$path = stripslashes($_POST['path']);
$view = new \OC\Files\View('/'.$user.'/files');
$newAvatar = $view->file_get_contents($path);
- }
-
- if (!empty($_FILES)) {
+ } elseif (!empty($_FILES)) {
$files = $_FILES['files'];
if (
$files['error'][0] === 0 &&
@@ -57,6 +55,10 @@ class OC_Core_Avatar_Controller {
$newAvatar = file_get_contents($files['tmp_name'][0]);
unlink($files['tmp_name'][0]);
}
+ } else {
+ $l = new \OC_L10n('core');
+ \OC_JSON::error(array("data" => array("message" => $l->t("No image or file provided")) ));
+ return;
}
try {
@@ -101,8 +103,6 @@ class OC_Core_Avatar_Controller {
}
public static function getTmpAvatar($args) {
- $user = OC_User::getUser();
-
$tmpavatar = \OC_Cache::get('tmpavatar');
if (is_null($tmpavatar)) {
$l = new \OC_L10n('core');
diff --git a/lib/public/avatar.php b/lib/public/avatar.php
deleted file mode 100644
index 6da8e83a9af..00000000000
--- a/lib/public/avatar.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-/**
- * Copyright (c) 2013 Christopher Schäpers <christopher@schaepers.it>
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
- */
-
-namespace OCP;
-
-class Avatar extends \OC_Avatar {
-}