From 0f7fec6e09c620a7e8fa39f485af91160724ee9f Mon Sep 17 00:00:00 2001 From: Andreas Schempp Date: Thu, 19 Nov 2015 10:23:32 +0100 Subject: [PATCH 1/3] Recursive merge tokens to allow extending the existing groups --- config/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.php b/config/config.php index 36728095..ac0296ec 100644 --- a/config/config.php +++ b/config/config.php @@ -88,7 +88,7 @@ /** * Notification Center Notification Types */ -$GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE'] = array_merge( +$GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE'] = array_merge_recursive( (array) $GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE'], array( 'contao' => array( From 413d6131932f712ee064c740d2302832f575fba5 Mon Sep 17 00:00:00 2001 From: Andreas Schempp Date: Thu, 19 Nov 2015 10:24:18 +0100 Subject: [PATCH 2/3] Updated changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93b81257..6855a761 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ Notification Center Changelog =========================== +Version 1.3.3 (2015-??-??) +-------------------------- + +### Improved +- Developers can now easier extend the existing tokens + Version 1.3.2 (2015-10-14) -------------------------- From a3a170f366d44be41699a740537dba95ac222555 Mon Sep 17 00:00:00 2001 From: Yanick Witschi Date: Fri, 15 Jan 2016 16:12:40 +0100 Subject: [PATCH 3/3] - Attachment tokens in form notifications now also work when "save file" was enabled (#80) --- CHANGELOG.md | 3 ++- library/NotificationCenter/Util/Form.php | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6855a761..7173e3d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,12 @@ Notification Center Changelog =========================== -Version 1.3.3 (2015-??-??) +Version 1.3.3 (2016-01-15) -------------------------- ### Improved - Developers can now easier extend the existing tokens +- Attachment tokens in form notifications now also work when "save file" was enabled (#80) Version 1.3.2 (2015-10-14) diff --git a/library/NotificationCenter/Util/Form.php b/library/NotificationCenter/Util/Form.php index 4b93cf78..ef08bfcb 100644 --- a/library/NotificationCenter/Util/Form.php +++ b/library/NotificationCenter/Util/Form.php @@ -23,6 +23,19 @@ class Form */ public static function getFileUploadPathForToken(array $file) { + // Check if it has been saved by Contao and thus moved to it's final destination already + if (isset($file['uploaded']) && $file['uploaded'] === true) { + $basePath = TL_ROOT . '/'; + if (preg_match('/^' . preg_quote($basePath, '/') . '/', $file['tmp_name']) + && file_exists($file['tmp_name']) + ) { + + return str_replace($basePath, '', $file['tmp_name']); + } + + return null; + } + if (!is_uploaded_file($file['tmp_name'])) { return null; @@ -30,11 +43,9 @@ public static function getFileUploadPathForToken(array $file) $tmpDir = 'system/tmp'; $filePath = $tmpDir . '/' . $file['name']; - \Files::getInstance()->move_uploaded_file($file['tmp_name'], $filePath); \Files::getInstance()->chmod($filePath, $GLOBALS['TL_CONFIG']['defaultFileChmod']); - return $filePath; } }