/** * Unlink file/folder * * @static * @access public * @param string $path * @return boolean */ function unlink($path) { /* make sure the path exists */ if (!file_exists($path)) { return false; } /* If it is a file or link, just delete it */ if (is_file($path) || is_link($path)) { return @unlink($path); } /* Scan the dir and recursively unlink */ $files = CKFinder_Connector_Utils_FileSystem::php4_scandir($path); if ($files) { foreach ($files as $filename) { if ($filename == '.' || $filename == '..') { continue; } $file = str_replace('//', '/', $path . '/' . $filename); CKFinder_Connector_Utils_FileSystem::unlink($file); } } /* Remove the parent dir */ if (!@rmdir($path)) { return false; } return true; }