|
Revision 4914, 1.2 kB
(checked in by p_lindheimer, 5 years ago)
|
fix syntax error in functions.inc.php
|
- 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) { |
|---|
| 4 |
global $amp_conf; |
|---|
| 5 |
$i = 1; |
|---|
| 6 |
$arraycount = 0; |
|---|
| 7 |
|
|---|
| 8 |
$filearray = Array("default"); |
|---|
| 9 |
if (is_dir($path)){ |
|---|
| 10 |
if ($handle = opendir($path)){ |
|---|
| 11 |
while (false !== ($file = readdir($handle))){ |
|---|
| 12 |
if ( ($file != ".") && ($file != "..") && ($file != "CVS") && ($file != ".svn") ) |
|---|
| 13 |
{ |
|---|
| 14 |
if (is_dir("$path/$file")) |
|---|
| 15 |
$filearray[($i++)] = "$file"; |
|---|
| 16 |
} |
|---|
| 17 |
} |
|---|
| 18 |
closedir($handle); |
|---|
| 19 |
} |
|---|
| 20 |
} |
|---|
| 21 |
if (isset($filearray)) { |
|---|
| 22 |
sort($filearray); |
|---|
| 23 |
// add a none categoy for no music |
|---|
| 24 |
if (!in_array("none",$filearray)) { |
|---|
| 25 |
$filearray[($i++)] = "none"; |
|---|
| 26 |
} |
|---|
| 27 |
return ($filearray); |
|---|
| 28 |
} else { |
|---|
| 29 |
return null; |
|---|
| 30 |
} |
|---|
| 31 |
} |
|---|
| 32 |
|
|---|
| 33 |
function music_rmdirr($dirname) |
|---|
| 34 |
{ |
|---|
| 35 |
// Sanity check |
|---|
| 36 |
if (!file_exists($dirname)) { |
|---|
| 37 |
print "$dirname Doesn't exist\n"; |
|---|
| 38 |
return false; |
|---|
| 39 |
} |
|---|
| 40 |
|
|---|
| 41 |
// Simple delete for a file |
|---|
| 42 |
if (is_file($dirname)) { |
|---|
| 43 |
return unlink($dirname); |
|---|
| 44 |
} |
|---|
| 45 |
|
|---|
| 46 |
// Loop through the folder |
|---|
| 47 |
$dir = dir($dirname); |
|---|
| 48 |
while (false !== $entry = $dir->read()) { |
|---|
| 49 |
// Skip pointers |
|---|
| 50 |
if ($entry == '.' || $entry == '..') { |
|---|
| 51 |
continue; |
|---|
| 52 |
} |
|---|
| 53 |
|
|---|
| 54 |
// Recurse |
|---|
| 55 |
music_rmdirr("$dirname/$entry"); |
|---|
| 56 |
} |
|---|
| 57 |
|
|---|
| 58 |
// Clean up |
|---|
| 59 |
$dir->close(); |
|---|
| 60 |
return rmdir($dirname); |
|---|
| 61 |
} |
|---|
| 62 |
|
|---|
| 63 |
?> |
|---|