function makestreamcatergory($path_to_dir, $stream) { if (!is_dir($path_to_dir)) { makemusiccategory($path_to_dir); } $fh = fopen("{$path_to_dir}/.custom", "w"); fwrite($fh, $stream); fclose($fh); }
<?php $display = 1; $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : ''; $category = strtr(isset($_REQUEST['category']) ? $_REQUEST['category'] : '', " ", "-"); if ($category == null) { $category = 'Default'; } if ($category == "Default") { $path_to_dir = "/var/lib/asterisk/mohmp3"; } else { $path_to_dir = "/var/lib/asterisk/mohmp3/{$category}"; } //path to directory u want to read. switch ($action) { case "addednew": makemusiccategory($path_to_dir, $category); createmusicconf(); needreload(); break; case "addedfile": createmusicconf(); needreload(); break; case "delete": rmdirr("{$path_to_dir}"); $path_to_dir = "/var/lib/asterisk/mohmp3"; //path to directory u want to read. $category = 'Default'; createmusicconf(); needreload(); break;