summaryrefslogtreecommitdiffstats
path: root/core/avatar
diff options
context:
space:
mode:
authorkondou <kondou@ts.unde.re>2013-09-04 22:13:59 +0200
committerkondou <kondou@ts.unde.re>2013-09-04 22:13:59 +0200
commitb643c02bd5b6bdf7e1dbbc549ce2a089a009fbc8 (patch)
treeec28b2ac35ace95662519e44dd76a9ba74fc9cd0 /core/avatar
parent68dce9dde569a039da68cd2c1244ca89984aba34 (diff)
downloadnextcloud-server-b643c02bd5b6bdf7e1dbbc549ce2a089a009fbc8.tar.gz
nextcloud-server-b643c02bd5b6bdf7e1dbbc549ce2a089a009fbc8.zip
Fix some bugs and remove \OCP\Avatar for now
Diffstat (limited to 'core/avatar')
-rw-r--r--core/avatar/controller.php12
1 files changed, 6 insertions, 6 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');