Files
PHPMailer6
auswertung
bootstrap
classes
config
controller
dashboard
datepicker
fpdf186
jquery
js
language
lib
old
demo
lexer
libs
internals
core.assemble_plugin_filepath.php
core.assign_smarty_interface.php
core.create_dir_structure.php
core.display_debug_console.php
core.get_include_path.php
core.get_microtime.php
core.get_php_resource.php
core.is_secure.php
core.is_trusted.php
core.load_plugins.php
core.load_resource_plugin.php
core.process_cached_inserts.php
core.process_compiled_include.php
core.read_cache_file.php
core.rm_auto.php
core.rmdir.php
core.run_insert_handler.php
core.smarty_include_php.php
core.write_cache_file.php
core.write_compiled_include.php
core.write_compiled_resource.php
core.write_file.php
plugins
sysplugins
Autoloader.php
Config_File.class.php
Smarty.class.php
SmartyBC.class.php
Smarty_Compiler.class.php
debug.tpl
.gitattributes
.gitignore
.travis.yml
BUGS
COMPOSER_RELEASE_NOTES.txt
COPYING.lib
ChangeLog
FAQ
INHERITANCE_RELEASE_NOTES.txt
INSTALL
NEWS
NEW_FEATURES.txt
QUICK_START
README
README.md
RELEASE_NOTES
SMARTY_2_BC_NOTES.txt
SMARTY_3.0_BC_NOTES.txt
SMARTY_3.1_NOTES.txt
TODO
change_log.txt
composer.json
smarty
smarty2
smarty_3
Smarty-2.6.28.zip
smarty-3.1.29.zip
media
msd
selfregistration
sql
survey
templates
test
tinymce
.gitignore
Hinweise_zu_php8.txt
config.inc.php
todo.txt
survey/lib/old/libs/internals/core.rmdir.php
2023-03-14 14:47:50 +01:00

55 lines
1.4 KiB
PHP

<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* delete a dir recursively (level=0 -> keep root)
* WARNING: no tests, it will try to remove what you tell it!
*
* @param string $dirname
* @param integer $level
* @param integer $exp_time
* @return boolean
*/
// $dirname, $level = 1, $exp_time = null
function smarty_core_rmdir($params, &$smarty)
{
if(!isset($params['level'])) { $params['level'] = 1; }
if(!isset($params['exp_time'])) { $params['exp_time'] = null; }
if($_handle = @opendir($params['dirname'])) {
while (false !== ($_entry = readdir($_handle))) {
if ($_entry != '.' && $_entry != '..') {
if (@is_dir($params['dirname'] . DIRECTORY_SEPARATOR . $_entry)) {
$_params = array(
'dirname' => $params['dirname'] . DIRECTORY_SEPARATOR . $_entry,
'level' => $params['level'] + 1,
'exp_time' => $params['exp_time']
);
smarty_core_rmdir($_params, $smarty);
}
else {
$smarty->_unlink($params['dirname'] . DIRECTORY_SEPARATOR . $_entry, $params['exp_time']);
}
}
}
closedir($_handle);
}
if ($params['level']) {
return @rmdir($params['dirname']);
}
return (bool)$_handle;
}
/* vim: set expandtab: */
?>