summaryrefslogtreecommitdiffstats
path: root/core/ajax/share.php
diff options
context:
space:
mode:
authorStephan Arts <stephan@xfce.org>2013-06-14 17:38:56 +0200
committerStephan Arts <stephan@xfce.org>2013-06-14 17:38:56 +0200
commit3cd7747e7b9c10449f986e5f696a01cf4e50c318 (patch)
tree8678cbbbb63de71dd9bce2990dd7d536b2de8d91 /core/ajax/share.php
parent23446542360fa930614735a426eb4273a202e9ae (diff)
downloadnextcloud-server-3cd7747e7b9c10449f986e5f696a01cf4e50c318.tar.gz
nextcloud-server-3cd7747e7b9c10449f986e5f696a01cf4e50c318.zip
Use templates to theme share e-mails (#3683)
Diffstat (limited to 'core/ajax/share.php')
-rw-r--r--core/ajax/share.php23
1 files changed, 14 insertions, 9 deletions
diff --git a/core/ajax/share.php b/core/ajax/share.php
index 5854b65aa03..bdcb61284ec 100644
--- a/core/ajax/share.php
+++ b/core/ajax/share.php
@@ -94,23 +94,28 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
$l = OC_L10N::get('core');
// setup the email
- $subject = (string)$l->t('User %s shared a file with you', $displayName);
- if ($type === 'folder')
- $subject = (string)$l->t('User %s shared a folder with you', $displayName);
+ $subject = (string)$l->t('%s shared »%s« with you', array($displayName, $file));
- $text = (string)$l->t('User %s shared the file "%s" with you. It is available for download here: %s',
- array($displayName, $file, $link));
- if ($type === 'folder')
- $text = (string)$l->t('User %s shared the folder "%s" with you. It is available for download here: %s',
- array($displayName, $file, $link));
+ $content = new OC_Template("core", "mail", "");
+ $content->assign ('link', $link);
+ $content->assign ('type', $type);
+ $content->assign ('user_displayname', $displayName);
+ $content->assign ('filename', $file);
+ $text = $content->fetchPage();
+ $content = new OC_Template("core", "altmail", "");
+ $content->assign ('link', $link);
+ $content->assign ('type', $type);
+ $content->assign ('user_displayname', $displayName);
+ $content->assign ('filename', $file);
+ $alttext = $content->fetchPage();
$default_from = OCP\Util::getDefaultEmailAddress('sharing-noreply');
$from_address = OCP\Config::getUserValue($user, 'settings', 'email', $default_from );
// send it out now
try {
- OCP\Util::sendMail($to_address, $to_address, $subject, $text, $from_address, $displayName);
+ OCP\Util::sendMail($to_address, $to_address, $subject, $text, $from_address, $displayName, 1, $alttext);
OCP\JSON::success();
} catch (Exception $exception) {
OCP\JSON::error(array('data' => array('message' => OC_Util::sanitizeHTML($exception->getMessage()))));