getstatuses.php 581 B

12345678910111213141516171819202122232425
  1. <?php
  2. OCP\JSON::checkAppEnabled('files_sharing');
  3. OCP\JSON::checkLoggedIn();
  4. $items = array();
  5. $userDirectory = '/'.OCP\USER::getUser().'/files';
  6. $dirLength = strlen($userDirectory);
  7. if ($rows = OC_Share::getMySharedItems()) {
  8. for ($i = 0; $i < count($rows); $i++) {
  9. $source = $rows[$i]['source'];
  10. // Strip out user directory
  11. $item = substr($source, $dirLength);
  12. if ($rows[$i]['uid_shared_with'] == OC_Share::PUBLICLINK) {
  13. $items[$item] = true;
  14. } else if (!isset($items[$item])) {
  15. $items[$item] = false;
  16. }
  17. }
  18. }
  19. OCP\JSON::success(array('data' => $items));
  20. ?>