Location: PHPKode > projects > Brunhilde Media Server > brunhilde/edit.php
<?php

### edit.php ###
// generates the playlist viewing/editing form

include("global.php");

$playlist_url = rawurlencode(stripslashes($playlist));
$playlist = stripslashes(rawurldecode($playlist));

// makes sure that the "back to songlist" link will be displayed
$cdir = "blarg";

// turns the playlists contents into an array of lines
if (isset($Brunhilde[$playlist])) {
    $contents_array = explode("\n", $Brunhilde[$playlist]);
}

// head information
echo "<head><title>Brunhilde - Playlist Edit</title></head>\n";

// gets the standard logo and header
include("header.php");
 
// initializes the form for playlist editing
echo "<form method=post action=\"revise.php?playlist=$playlist_url\">\n";
echo "<font size=\"3\"><B>Rename Playlist</B></font><br>";
echo "<input type=text name=rename value=\"\"><br>\n";

echo "<p>\n";
echo "<TABLE width=100% border=0 $BORDER cellpadding=2 cellspacing=0><TBODY><TR><TD>";
echo "<table border=0 width=100% cellpadding=0 cellspacing=0>\n";
echo "<tr $TITLE valign=middle>";
echo "<td width=1%>";
echo "&nbsp;<a href=\"m3u.php?m3u=1&playlist=$playlist_url\"><img src=$PLAY_ICON alt=\"Listen to Playlist\"></a>";
echo "</td valign=center>";
echo "<td width=89% align=center>";
echo "<font size=\"4\"><B>".stripslashes($playlist)."</B></font>";
echo "</td><td width=30 align=center valign=center>";
echo "<font size=2><a href=\"delete.php?playlist=$playlist_url\"><B>&nbsp;&nbsp;Delete&nbsp;List&nbsp;</B></a></font>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</TD></TR></TBODY></TABLE>";

echo "<table border=0 cellpadding=0 cellspacing=2 width=100% $BORDER>\n";
echo "<tr><td>\n";
echo "<table border=0 cellpadding=1 cellspacing=1 width=100% $BODY>\n";
echo "</td></tr></tr><tr><td>\n";

echo "<br>\n";
echo "<table border=\"0\" width=\"100%\">\n";
echo "<B>&nbsp;Delete&nbsp;Songs:</B>";
echo "</table>";

echo "<table border=0 width=100% cellpadding=1 cellspacing=0>";
echo "<TBODY>";

// loops through the playlist array, displaying each element
if (isset($contents_array))
for($i = 0,$number = 1; $i < sizeof($contents_array); $i++,$number++) {

  // eliminates the path and backslashes in the display
  $name_array = explode("/", $contents_array[$i]);
  $song_name = stripslashes($name_array[sizeof($name_array) - 1]);

  echo "<tr>";
  echo "<td width=\"1%\" valign=\"top\">";
  echo "<input type=checkbox name=del[] value=$i></a>&nbsp;</td>";
  echo "<td width=1% align=right>&nbsp;$number.&nbsp;</td>";

   // creates an address to play the individual song when it is clicked
  $play_url = rawurlencode(stripslashes($contents_array[$i]));
  // increments the counter to retrieve the base variable
  $i++;
  $base = $contents_array[$i];
  $play_url = $play_url."&base=".$base;
  // id3 info icon/link
  echo "<td width=\"1%\">";
  echo "<a href=id3.php?playlist=$playlist_url&m3u=$play_url>";
  echo "<img src=$ID3_ICON alt=\"View id3 Tag\"></a>&nbsp;</td>";
  // Song title/link
  echo "<td width=\"98%\">";
  echo "<a href=m3u.php?play=$play_url>";
  echo "$song_name";

    // optionally adds a download button to each song
    if($DOWNLOAD == 1) {
    echo "&nbsp;&nbsp;&nbsp;";
    echo "<a href=download.php?play=$play_url>";
    echo "<img src=$DOWNLOAD_ICON alt=\"Downlod Song\"></a>";
				           }
  
  echo "</td>";
  echo "</tr>\n";
  }

echo "</TBODY></TABLE></td></tr></table></td></tr></table>\n";
echo "</p>\n";

// wraps up the html
echo "<br><input type=checkbox name=shuffle><B>&nbsp;Shuffle&nbsp;Playlist&nbsp;</B>";
echo "&nbsp;&nbsp;<input type=checkbox name=sort><B>&nbsp;Sort&nbsp;Playlist</B><br>";
echo "<br><input type=submit value=Change><br><br>";

include("footer.php");

echo "</html>";

?>
Return current item: Brunhilde Media Server