summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/ajax/getstatuses.php
blob: 8edcb214758ae78412f0fdb8894b4c25a32b4895 (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
25
<?php
require_once(OC::$APPSROOT . '/apps/files_sharing/lib_share.php');

OCP\JSON::checkAppEnabled('files_sharing');
OCP\JSON::checkLoggedIn();

$items = array();
$userDirectory = '/'.OCP\USER::getUser().'/files';
$dirLength = strlen($userDirectory);
if ($rows = OC_Share::getMySharedItems()) {
	for ($i = 0; $i < count($rows); $i++) {
		$source = $rows[$i]['source'];
		// Strip out user directory
		$item = substr($source, $dirLength);
		if ($rows[$i]['uid_shared_with'] == OC_Share::PUBLICLINK) {
			$items[$item] = true;
		} else if (!isset($items[$item])) {
			$items[$item] = false;
		}
	}
}

OCP\JSON::success(array('data' => $items));

?>