|
Revision 9083, 1.4 kB
(checked in by p_lindheimer, 3 years ago)
|
Auto Check-in of any outstanding patches
|
- Property svn:eol-style set to
native
- Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
function music_list($path=null) { |
|---|
| 4 |
if ($path === null) { |
|---|
| 5 |
global $amp_conf; |
|---|
| 6 |
|
|---|
| 7 |
if (!isset($amp_conf['MOHDIR'])) { |
|---|
| 8 |
$amp_conf['MOHDIR'] = '/mohmp3'; |
|---|
| 9 |
} |
|---|
| 10 |
$path = $amp_conf['ASTVARLIBDIR'].'/'.$amp_conf['MOHDIR']; |
|---|
| 11 |
} |
|---|
| 12 |
$i = 1; |
|---|
| 13 |
$arraycount = 0; |
|---|
| 14 |
$filearray = Array("default"); |
|---|
| 15 |
|
|---|
| 16 |
if (is_dir($path)){ |
|---|
| 17 |
if ($handle = opendir($path)){ |
|---|
| 18 |
while (false !== ($file = readdir($handle))){ |
|---|
| 19 |
if ( ($file != ".") && ($file != "..") && ($file != "CVS") && ($file != ".svn") && ($file != ".nomusic_reserved" ) ) |
|---|
| 20 |
{ |
|---|
| 21 |
if (is_dir("$path/$file")) |
|---|
| 22 |
$filearray[($i++)] = "$file"; |
|---|
| 23 |
} |
|---|
| 24 |
} |
|---|
| 25 |
closedir($handle); |
|---|
| 26 |
} |
|---|
| 27 |
} |
|---|
| 28 |
if (isset($filearray)) { |
|---|
| 29 |
sort($filearray); |
|---|
| 30 |
|
|---|
| 31 |
if (!in_array("none",$filearray)) { |
|---|
| 32 |
$filearray[($i++)] = "none"; |
|---|
| 33 |
} |
|---|
| 34 |
return ($filearray); |
|---|
| 35 |
} else { |
|---|
| 36 |
return null; |
|---|
| 37 |
} |
|---|
| 38 |
} |
|---|
| 39 |
|
|---|
| 40 |
function music_rmdirr($dirname) |
|---|
| 41 |
{ |
|---|
| 42 |
|
|---|
| 43 |
if (!file_exists($dirname)) { |
|---|
| 44 |
print "$dirname Doesn't exist\n"; |
|---|
| 45 |
return false; |
|---|
| 46 |
} |
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
if (is_file($dirname)) { |
|---|
| 50 |
return unlink($dirname); |
|---|
| 51 |
} |
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
$dir = dir($dirname); |
|---|
| 55 |
while (false !== $entry = $dir->read()) { |
|---|
| 56 |
|
|---|
| 57 |
if ($entry == '.' || $entry == '..') { |
|---|
| 58 |
continue; |
|---|
| 59 |
} |
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
music_rmdirr("$dirname/$entry"); |
|---|
| 63 |
} |
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
$dir->close(); |
|---|
| 67 |
return rmdir($dirname); |
|---|
| 68 |
} |
|---|
| 69 |
|
|---|
| 70 |
?> |
|---|
| 71 |
|
|---|