use localised date in notification mails

This commit is contained in:
Bjoern Schiessle 2014-01-27 12:47:54 +01:00
parent 46745895ae
commit 2bb13a8db9
1 changed files with 4 additions and 5 deletions

View File

@ -121,7 +121,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
if (isset($items[0]['expiration'])) { if (isset($items[0]['expiration'])) {
try { try {
$date = new DateTime($items[0]['expiration']); $date = new DateTime($items[0]['expiration']);
$expiration = $date->format('Y-m-d'); $expiration = $l->l('date', $date->getTimestamp());
} catch (Exception $e) { } catch (Exception $e) {
\OCP\Util::writeLog('sharing', "Couldn't read date: " . $e->getMessage(), \OCP\Util::ERROR); \OCP\Util::writeLog('sharing', "Couldn't read date: " . $e->getMessage(), \OCP\Util::ERROR);
} }
@ -187,6 +187,8 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
break; break;
case 'email': case 'email':
// enable l10n support
$l = OC_L10N::get('core');
// read post variables // read post variables
$user = OCP\USER::getUser(); $user = OCP\USER::getUser();
$displayName = OCP\User::getDisplayName(); $displayName = OCP\User::getDisplayName();
@ -199,16 +201,13 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
if (isset($_POST['expiration']) && $_POST['expiration'] !== '') { if (isset($_POST['expiration']) && $_POST['expiration'] !== '') {
try { try {
$date = new DateTime($_POST['expiration']); $date = new DateTime($_POST['expiration']);
$expiration = $date->format('Y-m-d'); $expiration = $l->l('date', $date->getTimestamp());
} catch (Exception $e) { } catch (Exception $e) {
\OCP\Util::writeLog('sharing', "Couldn't read date: " . $e->getMessage(), \OCP\Util::ERROR); \OCP\Util::writeLog('sharing', "Couldn't read date: " . $e->getMessage(), \OCP\Util::ERROR);
} }
} }
// enable l10n support
$l = OC_L10N::get('core');
// setup the email // setup the email
$subject = (string)$l->t('%s shared »%s« with you', array($displayName, $file)); $subject = (string)$l->t('%s shared »%s« with you', array($displayName, $file));