blob: 4c8ff0c416937fe91733cd5e97e5e1428ee2cb56 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
<?php
OC_JSON::checkLoggedIn();
OC_JSON::callCheck();
$user = OC_User::getUser();
if(isset($_POST['path'])) {
if ($_POST['path'] === "false") { // delete avatar
\OC_Avatar::setLocalAvatar($user, false);
} else { // select an image from own files
try {
$path = OC::$SERVERROOT.'/data/'.$user.'/files'.$_POST['path'];
\OC_Avatar::setLocalAvatar($user, $path);
OC_JSON::success();
} catch (Exception $e) {
OC_JSON::error();
}
}
} elseif (isset($_POST['image'])) { // upload a new image
\OC_Avatar::setLocalAvatar($user, $_POST['image']);
OC_JSON::success();
} else {
OC_JSON::error();
}
|