1: <?php
2: 3: 4: 5: 6:
7:
8: 9: 10: 11: 12: 13: 14: 15: 16:
17:
18:
19:
20: function smarty_core_rmdir($params, &$smarty)
21: {
22: if(!isset($params['level'])) { $params['level'] = 1; }
23: if(!isset($params['exp_time'])) { $params['exp_time'] = null; }
24:
25: if($_handle = @opendir($params['dirname'])) {
26:
27: while (false !== ($_entry = readdir($_handle))) {
28: if ($_entry != '.' && $_entry != '..') {
29: if (@is_dir($params['dirname'] . DIRECTORY_SEPARATOR . $_entry)) {
30: $_params = array(
31: 'dirname' => $params['dirname'] . DIRECTORY_SEPARATOR . $_entry,
32: 'level' => $params['level'] + 1,
33: 'exp_time' => $params['exp_time']
34: );
35: smarty_core_rmdir($_params, $smarty);
36: }
37: else {
38: $smarty->_unlink($params['dirname'] . DIRECTORY_SEPARATOR . $_entry, $params['exp_time']);
39: }
40: }
41: }
42: closedir($_handle);
43: }
44:
45: if ($params['level']) {
46: return @rmdir($params['dirname']);
47: }
48: return (bool)$_handle;
49:
50: }
51:
52:
53:
54: ?>
55: