From b643c02bd5b6bdf7e1dbbc549ce2a089a009fbc8 Mon Sep 17 00:00:00 2001 From: kondou Date: Wed, 4 Sep 2013 22:13:59 +0200 Subject: Fix some bugs and remove \OCP\Avatar for now --- core/avatar/controller.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'core/avatar') 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'); -- cgit v1.2.3