function lc_remove($source) { global $lC_Language, $lC_MessageStack; if (is_dir($source)) { $dir = dir($source); while ($file = $dir->read()) { if ($file != '.' && $file != '..') { if (is_writeable($source . '/' . $file)) { lc_remove($source . '/' . $file); } else { $lC_MessageStack->add('header', sprintf($lC_Language->get('ms_error_file_not_removable'), $source . '/' . $file), 'error'); } } } $dir->close(); if (is_writeable($source)) { return rmdir($source); } else { $lC_MessageStack->add('header', sprintf($lC_Language->get('ms_error_directory_not_removable'), $source), 'error'); } } else { if (is_writeable($source)) { return unlink($source); } else { $lC_MessageStack->add('header', sprintf($lC_Language->get('ms_error_file_not_removable'), $source), 'error'); } } }
public static function delete($entry, $directory) { $target = $directory . '/' . basename($entry); if (is_writeable($target)) { lc_remove($target); return true; } return false; }