function music_rmdirr($dirname) { // Sanity check if (!file_exists($dirname)) { print "{$dirname} Doesn't exist\n"; return false; } // Simple delete for a file if (is_file($dirname)) { return unlink($dirname); } // Loop through the folder $dir = dir($dirname); while (false !== ($entry = $dir->read())) { // Skip pointers if ($entry == '.' || $entry == '..') { continue; } // Recurse music_rmdirr("{$dirname}/{$entry}"); } // Clean up $dir->close(); return rmdir($dirname); }
redirect_standard(); case "addednew": makemusiccategory($path_to_dir); createmusicconf(); needreload(); redirect_standard(); break; case "addedfile": createmusicconf(); needreload(); // redirect_standard(); break; case "delete": //$fh = fopen("/tmp/music.log","a"); //fwrite($fh,print_r($_REQUEST,true)); music_rmdirr("{$path_to_dir}"); $path_to_dir = $path_to_moh_dir; $category = 'default'; createmusicconf(); needreload(); redirect_standard(); break; } ?> </div> <div class="rnav"><ul> <li><a href="config.php?display=<?php echo urlencode($display); ?> &action=add"><?php echo _("Add Music Category");