Fixed bug #16314: Incorrect use of is_dir in class.tx_rtehtmlarea_clearrtecache.php...
authorStanislas Rolland <typo3@sjbr.ca>
Thu, 11 Nov 2010 15:57:46 +0000 (15:57 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Thu, 11 Nov 2010 15:57:46 +0000 (15:57 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/branches/TYPO3_4-3@9338 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/hooks/clearrtecache/class.tx_rtehtmlarea_clearrtecache.php

index 8dbd881..a0d0771 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-11-11  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Fixed bug #16314: Incorrect use of is_dir in class.tx_rtehtmlarea_clearrtecache.php (Thanks to Juergen Deisenroth)
+
 2010-11-11  Christian Kuhn  <lolli@schwarzbu.ch>
 
        * Fixed bug #16352: [saltedpasswords] Login with bulk updated passwords from t3sec_saltedpw not working (Thanks to Marcus Krause)
index 5f57bd5..ed30ce4 100644 (file)
@@ -1,3 +1,7 @@
+2010-11-11  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Fixed bug #16314: Incorrect use of is_dir in class.tx_rtehtmlarea_clearrtecache.php (Thanks to Juergen Deisenroth)
+
 2010-10-18  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Fixed bug #16050: htmlArea RTE: Backspacing in empty editing area may raise js error
index ecaaa81..2bc32da 100644 (file)
 class tx_rtehtmlarea_clearrtecache {
        function clearTempDir() {
                $tempPath = t3lib_div::resolveBackPath(PATH_typo3.'../typo3temp/rtehtmlarea/');
-               $handle=opendir($tempPath);
-               while ($data=readdir($handle)) {
-                       if (!is_dir($data) && $data!="." && $data!="..") {
-                               unlink($tempPath.$data);
+               $handle = @opendir($tempPath);
+               if ($handle !== FALSE) {
+                       while (($file = readdir($handle)) !== FALSE) {
+                               if ($file != '.' && $file != '..') {
+                                       $tempFile = $tempPath . $file;
+                                       if (is_file($tempFile)) {
+                                               unlink($tempFile);
+                                       }
+                               }
                        }
+                       closedir($handle);
                }
-               closedir($handle);
        }
 }