Skip to content

Commit

Permalink
Merge branch 'hotfix/1.3.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
Toflar committed Jan 15, 2016
2 parents 3dcf209 + a3a170f commit 3ae82a4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Notification Center Changelog
===========================

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)
--------------------------
Expand Down
2 changes: 1 addition & 1 deletion config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
15 changes: 13 additions & 2 deletions library/NotificationCenter/Util/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,29 @@ 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;
}

$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;
}
}

0 comments on commit 3ae82a4

Please sign in to comment.