summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/ajax/share.php
blob: f0166f391db55b797f2fb6e375ce0b4a1e12ea40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
$RUNTIME_NOAPPS = true;

require_once('../../../lib/base.php');
require_once('../lib_share.php');

$sources = explode(";", $_POST['sources']);
$uid_shared_with = $_POST['uid_shared_with'];
$permissions = $_POST['permissions'];
foreach ($sources as $source) {
	if ($source && OC_FILESYSTEM::file_exists($source) && OC_FILESYSTEM::is_readable($source)) {
		$source = "/".OC_User::getUser()."/files".$source;
		try {
			new OC_Share($source, $uid_shared_with, $permissions);
		} catch (Exception $exception) {
			echo "false";
		}
	}
}

?>