diff --git a/twe/func.php b/twe/func.php index 75e2faeb..5620c6c7 100644 --- a/twe/func.php +++ b/twe/func.php @@ -79,17 +79,19 @@ function abilityPowint() { function delInDir($dir) { $handle = opendir($dir); - while(false !== ($FolderOrFile = readdir($handle))) { - if($FolderOrFile == "." || $FolderOrFile == "..") { - continue; - } + if($handle !== false){ + while(false !== ($FolderOrFile = readdir($handle))) { + if ($FolderOrFile == "." || $FolderOrFile == "..") { + continue; + } - $filepath = sprintf('%s/%s', $dir, $FolderOrFile); - if(is_dir($filepath)) { - delInDir($filepath); - } // recursive - else { - @unlink($filepath); + $filepath = sprintf('%s/%s', $dir, $FolderOrFile); + if (is_dir($filepath)) { + delInDir($filepath); + } // recursive + else { + @unlink($filepath); + } } } closedir($handle);