2012-04-26 18:33:06 +04:00
|
|
|
<?php
|
2012-05-03 14:23:29 +04:00
|
|
|
OCP\JSON::checkLoggedIn();
|
|
|
|
OCP\JSON::checkAppEnabled('files_sharing');
|
2012-07-07 18:03:21 +04:00
|
|
|
OCP\JSON::callCheck();
|
|
|
|
|
2012-05-01 20:50:31 +04:00
|
|
|
$user = OCP\USER::getUser();
|
2012-04-26 18:33:06 +04:00
|
|
|
// TODO translations
|
2012-05-15 04:21:07 +04:00
|
|
|
$type = (strpos($_POST['file'], '.') === false) ? 'folder' : 'file';
|
|
|
|
$subject = $user.' shared a '.$type.' with you';
|
2012-05-15 04:09:10 +04:00
|
|
|
$link = $_POST['link'];
|
2012-05-15 04:21:07 +04:00
|
|
|
$text = $user.' shared the '.$type.' '.$_POST['file'].' with you. It is available for download here: '.$link;
|
2012-05-31 22:26:09 +04:00
|
|
|
$fromaddress = OCP\Config::getUserValue($user, 'settings', 'email', 'sharing-noreply@'.OCP\Util::getServerHost());
|
2012-07-30 02:01:43 +04:00
|
|
|
try {
|
|
|
|
OCP\Util::sendMail($_POST['toaddress'], $_POST['toaddress'], $subject, $text, $fromaddress, $user);
|
|
|
|
OCP\JSON::success();
|
|
|
|
} catch (Exception $exception) {
|
|
|
|
OCP\JSON::error(array('data' => array('message' => $exception->getMessage())));
|
|
|
|
}
|