Fix some bugs and remove \OCP\Avatar for now

This commit is contained in:
kondou 2013-09-04 22:13:59 +02:00
parent 68dce9dde5
commit b643c02bd5
2 changed files with 6 additions and 18 deletions

View File

@ -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');

View File

@ -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 {
}