diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-01-23 11:18:23 +0100 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-01-24 10:46:08 +0100 |
commit | 77de47858b6f53bfa36b84de5e316e6e804ad7ca (patch) | |
tree | 37600e097c1dfd3240aad1dcda8a09edbb8fba04 /core/ajax | |
parent | 0daabe5b6a2f96e8b754c2414bb83d00277a307a (diff) | |
download | nextcloud-server-77de47858b6f53bfa36b84de5e316e6e804ad7ca.tar.gz nextcloud-server-77de47858b6f53bfa36b84de5e316e6e804ad7ca.zip |
add expire date to link share if possible
Diffstat (limited to 'core/ajax')
-rw-r--r-- | core/ajax/share.php | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/core/ajax/share.php b/core/ajax/share.php index be02c056357..268cd4f53a7 100644 --- a/core/ajax/share.php +++ b/core/ajax/share.php @@ -119,8 +119,12 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo $subject = (string)$l->t('%s shared »%s« with you', array($ownerDisplayName, $filename)); $expiration = null; if (isset($items[0]['expiration'])) { - $date = new DateTime($items[0]['expiration']); - $expiration = $date->format('Y-m-d'); + try { + $date = new DateTime($items[0]['expiration']); + $expiration = $date->format('Y-m-d'); + } catch (Exception $e) { + \OCP\Util::writeLog('sharing', "Couldn't read date: " . $e->getMessage(), \OCP\Util::ERROR); + } } if ($itemType === 'folder') { @@ -191,6 +195,17 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo $file = $_POST['file']; $to_address = $_POST['toaddress']; + $expiration = null; + if (isset($_POST['expiration']) && $_POST['expiration'] !== '') { + try { + $date = new DateTime($_POST['expiration']); + $expiration = $date->format('Y-m-d'); + } catch (Exception $e) { + \OCP\Util::writeLog('sharing', "Couldn't read date: " . $e->getMessage(), \OCP\Util::ERROR); + } + + } + // enable l10n support $l = OC_L10N::get('core'); @@ -202,6 +217,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo $content->assign ('type', $type); $content->assign ('user_displayname', $displayName); $content->assign ('filename', $file); + $content->assign('expiration', $expiration); $text = $content->fetchPage(); $content = new OC_Template("core", "altmail", ""); @@ -209,6 +225,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo $content->assign ('type', $type); $content->assign ('user_displayname', $displayName); $content->assign ('filename', $file); + $content->assign('expiration', $expiration); $alttext = $content->fetchPage(); $default_from = OCP\Util::getDefaultEmailAddress('sharing-noreply'); |