2011-07-20 17:34:16 +00:00
|
|
|
<?php
|
|
|
|
$RUNTIME_NOAPPS = true;
|
|
|
|
|
|
|
|
require_once('../../../lib/base.php');
|
|
|
|
require_once('../lib_share.php');
|
|
|
|
|
2011-08-24 16:32:02 +00:00
|
|
|
$userDirectory = "/".OC_User::getUser()."/files";
|
2011-08-01 00:47:53 +00:00
|
|
|
$sources = explode(";", $_POST['sources']);
|
|
|
|
$uid_shared_with = $_POST['uid_shared_with'];
|
|
|
|
$permissions = $_POST['permissions'];
|
2011-07-28 19:31:52 +00:00
|
|
|
foreach ($sources as $source) {
|
2011-08-24 16:32:02 +00:00
|
|
|
// Make sure file exists and can be shared
|
2011-08-12 21:22:32 +00:00
|
|
|
if ($source && OC_FILESYSTEM::file_exists($source) && OC_FILESYSTEM::is_readable($source)) {
|
2011-08-24 16:32:02 +00:00
|
|
|
$source = $userDirectory.$source;
|
|
|
|
// If the file doesn't exist, it may be shared with the current user
|
|
|
|
} else {
|
|
|
|
$source = OC_Share::getSource($userDirectory.$source);
|
|
|
|
if (!$source) {
|
2011-08-12 21:22:32 +00:00
|
|
|
echo "false";
|
|
|
|
}
|
|
|
|
}
|
2011-08-24 16:32:02 +00:00
|
|
|
try {
|
|
|
|
$shared = new OC_Share($source, $uid_shared_with, $permissions);
|
|
|
|
if ($uid_shared_with == OC_Share::PUBLICLINK) {
|
|
|
|
echo $shared->getToken();
|
|
|
|
}
|
|
|
|
} catch (Exception $exception) {
|
|
|
|
echo "false";
|
|
|
|
}
|
2011-07-28 19:31:52 +00:00
|
|
|
}
|
2011-07-20 17:34:16 +00:00
|
|
|
|
|
|
|
?>
|