diff -Naur 100402/gjukebox/NEWS bugfix.offof100402/gjukebox/NEWS
--- 100402/gjukebox/NEWS	Thu Oct  3 06:25:09 2002
+++ bugfix.offof100402/gjukebox/NEWS	Wed Oct  9 10:45:41 2002
@@ -1,5 +1,9 @@
 Version 4.1pre4
 
+2002-10-08 ejs: Bugfix for import.pl not handling special chars in ogg files
+2002-10-08 ejs: Addform has been updated to show confirmation when song is added
+                The layout has been modified to be more intuitive.
+                And you can manually add Genre's
 2002-09-24 ejs: Added Varible for Ogg Quality Level
 2002-09-24 ejs: Added Genre,Year, and comment support
 2002-09-24 ejs: Added Strict Exclude Option
diff -Naur 100402/gjukebox/scripts/import.pl bugfix.offof100402/gjukebox/scripts/import.pl
--- 100402/gjukebox/scripts/import.pl	Fri Oct  4 03:04:26 2002
+++ bugfix.offof100402/gjukebox/scripts/import.pl	Tue Oct  8 11:42:55 2002
@@ -234,6 +234,7 @@
 sub getogginfo{
 	my ($name)=@_;
 	#Get the comments field of the ogg file and parse it.
+	$name =~ s/(\ |\	|\"|\'|\:|\`|\~|\@|\#|\$|\%|\^|\_|\+|\=|\\|\,|\||\&|\;|\(|\)|\<|\>|\{|\{|\[|\]|\!)/\\$1/gmi;
 	open(OGGINFO,"$OGGINFO $name|");
 	my ($var,$value,$title,$artist,$album,$tracknumber,$date,$genre,$comment);
 	while(<OGGINFO>){
diff -Naur 100402/gjukebox/www/action.php bugfix.offof100402/gjukebox/www/action.php
--- 100402/gjukebox/www/action.php	Thu Oct  3 06:25:11 2002
+++ bugfix.offof100402/gjukebox/www/action.php	Tue Oct  8 12:59:30 2002
@@ -410,47 +410,48 @@
                 $year=prepareDB($YEAR);
                 $comment=prepareDB($COMMENT);
                 $trackno=(int)$TRACKNO;
-	        if (!$trackno)
-		    $trackno="NULL";
-
+	        if (!$trackno) $trackno="NULL";
 		$file=$FILE;
+		$url=$URL;
+		if (!$file&&$url) $file=$url;
 		if (!$file&&$UPLOAD) {
-		    $file="$incomingdir".eregi_replace("[^a-z0-9]+","_",$ARTIST)."-".eregi_replace("[^a-z0-9]+","_",$SONG).".$FORMAT";
-		    if (!copy($UPLOAD,$file)) {
-			print "Couldn't copy $UPLOAD $UPLOAD_file to $file\n";
-			exit;
-		    }
-		}
+			$file="$incomingdir".eregi_replace("[^a-z0-9]+","_",$ARTIST)."-".eregi_replace("[^a-z0-9]+","_",$SONG).".$FORMAT";
+			if (!copy($UPLOAD,$file)) {
+				print "Couldn't copy $UPLOAD $UPLOAD_file to $file\n";
+				exit;
+				}
+			}
 		if (!$file) {
-		    print "No filename specified!";
-		    exit;
-		}
+			print "No filename specified!";
+			exit;
+			}
 		$file=prepareDB($file);
-	        if ($OLDID) { # if we have an OLDID then we're just updating the details on a file.
-		    $location="addform.php?OLDID=$OLDID";
-		    if (!$REFVOL)
-			$refvol=0;
-		    else
-			$refvol=$REFVOL;
-		    mysql_query("update songs set artist = $artist, title = $song, volume = $volume, file = $file, format = '$FORMAT', difvol = $refvol, trackno = $trackno, year = $year, genre = $genre, comment = $comment where id = $OLDID");
-	            }
+	        
+		if ($OLDID) { # if we have an OLDID then we're just updating the details on a file.
+			$location="addform.php?OLDID=$OLDID";
+			if (!$REFVOL) $refvol=0;
+		    	else $refvol=$REFVOL;
+			mysql_query("update songs set artist = $artist, title = $song, volume = $volume, file = $file, format = '$FORMAT', difvol = $refvol, trackno = $trackno, year = $year, genre = $genre, comment = $comment where id = $OLDID");
+	        	}
 		else { # Since we don't have an oldid we're adding a song
-		    $location="addform.php?ARTIST=".urlencode($ARTIST)."&FILE=".urlencode($FILE);
-		    if (ereg("://",$file)) { #if it's a url then we need to download the actual file (and ripd takes care of us)
-		        mysql_query("insert into ripqueue (id,songid,fromid,toid,artist,title,album,file,status,user,trackno,log,genre,year,comment) values (0,0,'url','$format',$artist,$song,$volume,$file,0,'$MUSICUSER',$trackno,NULL,$genre,$year,$comment)");
-		    } else {
-  	 	        mysql_query("insert into songs (artist,title,volume,file,played,voted,toplist,lastplayed,entered,format,user,trackno,genre,year,comment) values ($artist,$song,$volume,$file,".
-			  	    "0,0,0,now(),now(),'$FORMAT','$MUSICUSER',$trackno,$genre,$year,$comment)");
-			$id=mysql_insert_id();
-			if ($alsogroup=fetchSetting('AUTOADD')) {
-			    list($gid)=mysql_fetch_array(mysql_query("select id from groups where name = ".prepareDB($alsogroup)));
-			    mysql_query("insert into groupmember values ($gid,$id)");
+			
+			if (ereg("://",$file)) { #if it's a url then we need to download the actual file (and ripd takes care of us)
+				mysql_query("insert into ripqueue (id,songid,fromid,toid,artist,title,album,file,status,user,trackno,log,genre,year,comment) values (0,0,'url','$format',$artist,$song,$volume,$file,0,'$MUSICUSER',$trackno,NULL,$genre,$year,$comment)");
+				$location="addform.php?CONFIRM=".urlencode("$file added to Ripqueue for download.");
+				}
+			else {
+  	 			mysql_query("insert into songs (artist,title,volume,file,played,voted,toplist,lastplayed,entered,format,user,trackno,genre,year,comment) values ($artist,$song,$volume,$file,0,0,0,now(),now(),'$FORMAT','$MUSICUSER',$trackno,$genre,$year,$comment)");
+				$id=mysql_insert_id();
+				if ($alsogroup=fetchSetting('AUTOADD')) {
+					list($gid)=mysql_fetch_array(mysql_query("select id from groups where name = ".prepareDB($alsogroup)));
+					mysql_query("insert into groupmember values ($gid,$id)");
+					}
+				mysql_query("insert into ripqueue (id,songid,fromid,toid,artist,title,album,file,status,user,trackno,log,genre,year,comment) values (0,$id,'mp3','analyse',$artist,$song,$volume,$file,0,'$MUSICUSER',$trackno,NULL)");
+		        	inserttune($id,$unauthpri);
+		    		$location="addform.php?CONFIRM=".urlencode("$file added to Jukebox.");
+				}
 			}
-			mysql_query("insert into ripqueue (id,songid,fromid,toid,artist,title,album,file,status,user,trackno,log,genre,year,comment) values (0,$id,'mp3','analyse',$artist,$song,$volume,$file,0,'$MUSICUSER',$trackno,NULL)");
-		        inserttune($id,$unauthpri);
-		    }
 		}
-	    }
 	} elseif ($ACTION=="upload"&&$UPLOAD&&$ID) { # I think this is used to upload to another jukebox (not really sure someone who knows should update this comment)
 	    $res=mysql_query("select hostname,user,pass from remotehosts where id = $UPLOAD");
 	    list($url,$user,$pass)=mysql_fetch_array($res);
diff -Naur 100402/gjukebox/www/addform.php bugfix.offof100402/gjukebox/www/addform.php
--- 100402/gjukebox/www/addform.php	Thu Oct  3 06:25:11 2002
+++ bugfix.offof100402/gjukebox/www/addform.php	Tue Oct  8 13:41:22 2002
@@ -95,44 +95,33 @@
 </HEAD>
 <?
 body("addform");
+if($CONFIRM) print $CONFIRM."<br>\n";
 ?>
 <TABLE><TR><TD>
 <?
+
 if (is_writeable($incomingdir)) {
-?>
-<FORM ENCTYPE="multipart/form-data" ACTION="action.php" METHOD=POST>
-<?
-} else {
-?>
-<FORM ACTION="action.php" METHOD=POST>
-<?
-}
-if ($OLDID)
-    print "<INPUT TYPE=hidden NAME=OLDID VALUE=$OLDID>";
+	?>
+	<FORM ENCTYPE="multipart/form-data" ACTION="action.php" METHOD=POST>
+	<?
+	}
+else {
+	?>
+	<FORM ACTION="action.php" METHOD=POST>
+	<?
+	}
+if ($OLDID) print "<INPUT TYPE=hidden NAME=OLDID VALUE=$OLDID>";
 ?>
 <P><INPUT TYPE=hidden NAME=ACTION VALUE=add>
-<TABLE><TR><TD>Artist</TD><TD>
-<INPUT TYPE=text NAME=ARTIST VALUE="<? print htmlspecialchars($ARTIST); ?>" >
-</TD></TR><TR><TD>
-Song</TD><TD>
-<INPUT TYPE=text NAME=SONG VALUE="<? print htmlspecialchars($SONG); ?>" >
-</TD></TR><TR><TD>
-Album</TD><TD>
-<INPUT TYPE=text NAME=VOLUME VALUE="<? print htmlspecialchars($VOLUME); ?>" >
-</TD></TR><TR><TD>
-Track number</TD><TD>
-<INPUT TYPE=text NAME=TRACKNO VALUE="<? print htmlspecialchars($TRACKNO); ?>" >
-</TD></TR><TR><TD>
-Comment</TD><TD>
-<INPUT TYPE=text NAME=COMMENT VALUE="<? print htmlspecialchars($COMMENT); ?>" MAXLENGTH=50 >
-</TD></TR><TR><TD>
-Year</TD><TD>
-<INPUT TYPE=text NAME=YEAR VALUE="<? print htmlspecialchars($YEAR); ?>" MAXLENGTH=4 >
-</TD></TR><TR><TD>
-Genre</TD><TD>
+<TABLE><TR><TD>Artist</TD><TD><INPUT TYPE=text NAME=ARTIST VALUE="<? print htmlspecialchars($ARTIST); ?>" ></TD></TR>
+<TR><TD>Song</TD><TD><INPUT TYPE=text NAME=SONG VALUE="<? print htmlspecialchars($SONG); ?>" ></TD></TR>
+<TR><TD>Album</TD><TD><INPUT TYPE=text NAME=VOLUME VALUE="<? print htmlspecialchars($VOLUME); ?>" ></TD></TR>
+<TR><TD>Track number</TD><TD><INPUT TYPE=text NAME=TRACKNO VALUE="<? print htmlspecialchars($TRACKNO); ?>" ></TD></TR>
+<TR><TD>Comment</TD><TD><INPUT TYPE=text NAME=COMMENT VALUE="<? print htmlspecialchars($COMMENT); ?>" MAXLENGTH=50 ></TD></TR>
+<TR><TD>Year</TD><TD><INPUT TYPE=text NAME=YEAR VALUE="<? print htmlspecialchars($YEAR); ?>" MAXLENGTH=4 ></TD></TR>
+<TR><TD>Genre</TD><TD>
 <SELECT NAME=GENREID>
 <?
-
 $res=mysql_query("select id,name from genre");
 while(list($gid,$gname)=mysql_fetch_array($res)){
 	if($GENREID==$gid){
@@ -142,9 +131,9 @@
 		print "<OPTION VALUE=$gid>$gname\n";
 		}
 	}
-?></SELECT></TD></TR>
-<TR><TD>
-Format:</TD><TD>
+?>
+</SELECT></TD><TD><a HREF="javascript: window.open('addgenre.php','','width=200,height=150,scrollbars=no');void('');">Add Genre</a></TD></TR>
+<TR><TD>Format:</TD><TD>
 <SELECT NAME=FORMAT>
 <?
 $res=mysql_query("select id,description,program,flags from formats order by description");
@@ -154,45 +143,54 @@
     } else
 	print "<OPTION VALUE=$id>$description\n";
 }
-?></SELECT></TD></TR>
-<TR><TD>
-File</TD><TD>
-<INPUT TYPE=text NAME=FILE VALUE="<? print htmlspecialchars($FILE); ?>" ></TD></TR>
-<?
-if($OLDID) {
 ?>
-<TR><TD>
-Reference volume</TD><TD>
-<INPUT TYPE=text NAME=REFVOL VALUE="<? print htmlspecialchars($REFVOL); ?>" ></TD></TR>
-</TABLE>
-<TABLE>
-<TR><TD VALIGN=top><B>Conversions</B></TD><TD><?
-$res=mysql_query("select toid,description from transformations where priority >= 0 and fromid = '$FORMAT' order by description");
-while(list($toid,$dsc)=mysql_fetch_array($res)) {
-    print "<A HREF=action.php?CONV=$OLDID&TOID=$toid>$dsc</A><BR>\n";
-}
-
-?></TD></TR>
-<TR><TD><A HREF=action.php?ACTION=del&ID=<? print $OLDID; ?> onMouseOver="self.status='Remove song from jukebox and filesystem'"><FONT COLOR=<? print warningColor(); ?> >Remove</A> from Jukebox and filesystem !!</FONT></TD></TR>
-<TR><TD><B>Played</B></TD><TD><? print $PLAYED; ?></TD></TR>
-<TR><TD><B>Voted</B></TD><TD><? print $VOTED; ?></TD></TR>
-<TR><TD><B>Toplist</B></TD><TD><? print ($TOPLIST/toplist()); ?></TD></TR>
-<TR><TD><B>Entered</B></TD><TD><? print $ENTERED; ?></TD></TR>
-<TR><TD><B>Last played</B></TD><TD><? print $LASTPLAYED; ?></TD></TR>
-<? print $extinfo; ?>
-</TABLE>
-<INPUT TYPE=submit VALUE=Change>
+</SELECT></TD></TR>
 <?
-} else {
+if($OLDID) {
+	?>
+	<TR><TD>File</TD><TD><INPUT TYPE=text NAME=FILE VALUE="<? print htmlspecialchars($FILE); ?>" ></TD></TR>
+	<TR><TD>Reference volume</TD><TD><INPUT TYPE=text NAME=REFVOL VALUE="<? print htmlspecialchars($REFVOL); ?>" ></TD></TR>
+	</TABLE>
+	<TABLE>
+	<TR><TD VALIGN=top><B>Conversions</B></TD><TD>
+	<?
+	$res=mysql_query("select toid,description from transformations where priority >= 0 and fromid = '$FORMAT' order by description");
+	while(list($toid,$dsc)=mysql_fetch_array($res)) {
+		print "<A HREF=action.php?CONV=$OLDID&TOID=$toid>$dsc</A><BR>\n";
+		}
+	?>
+	</TD></TR>
+	<TR><TD><A HREF=action.php?ACTION=del&ID=<? print $OLDID; ?> onMouseOver="self.status='Remove song from jukebox and filesystem'"><FONT COLOR=<? print warningColor(); ?> >Remove</A> from Jukebox and filesystem !!</FONT></TD></TR>
+	<TR><TD><B>Played</B></TD><TD><? print $PLAYED; ?></TD></TR>
+	<TR><TD><B>Voted</B></TD><TD><? print $VOTED; ?></TD></TR>
+	<TR><TD><B>Toplist</B></TD><TD><? print ($TOPLIST/toplist()); ?></TD></TR>
+	<TR><TD><B>Entered</B></TD><TD><? print $ENTERED; ?></TD></TR>
+	<TR><TD><B>Last played</B></TD><TD><? print $LASTPLAYED; ?></TD></TR>
+	<? print $extinfo; ?>
+	</TABLE>
+	<INPUT TYPE=submit VALUE=Change>
+	<?
+	}
+else {
+	?>
+	<INPUT TYPE=hidden NAME=MAX_FILE_SIZE VALUE=1000000000>
+	</table><br>
+	<table Border=1>
+	<TR><TD>File On Server</TD><TD><INPUT TYPE=text NAME=FILE ></TD></TR>
+	<TR><TD>Or Url</TD><TD><INPUT TYPE=text NAME=URL ></TD></TR>
+	<? 
+	if (is_writeable($incomingdir)) { 
+		?>
+		<TR><TD>Or Upload file</TD><TD>
+		<INPUT TYPE=file NAME=UPLOAD></TD></TR></TABLE>
+		<?
+		} 
+	?>
+	<br>
+	<INPUT TYPE=submit VALUE=Add>
+	<?
+	}
 ?>
-
-<INPUT TYPE=hidden NAME=MAX_FILE_SIZE VALUE=1000000000>
-<? if (is_writeable($incomingdir)) { ?>
-<TR><TD>Upload file</TD><TD>
-<INPUT TYPE=file NAME=UPLOAD></TD></TR></TABLE>
-<? } ?>
-<INPUT TYPE=submit VALUE=Add>
-<? } ?>
 <P>
 <?
 helpLink("admin");
diff -Naur 100402/gjukebox/www/addgenre.php bugfix.offof100402/gjukebox/www/addgenre.php
--- 100402/gjukebox/www/addgenre.php	Wed Dec 31 18:00:00 1969
+++ bugfix.offof100402/gjukebox/www/addgenre.php	Tue Oct  8 15:29:40 2002
@@ -0,0 +1,120 @@
+<?
+# ====================================================================
+# Copyright (c) 1999 GlobeCom GCAB AB.  All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer. 
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in
+#    the documentation and/or other materials provided with the
+#    distribution.
+#
+# 3. All advertising materials mentioning features or use of this
+#    software must display the following acknowledgment:
+#    "This product includes software developed by GlobeCom GCAB AB
+#    <http://www.globecom.net/> for use in GlobeCom Jukebox."
+#
+# 4. The names "GlobeCom Jukebox" and "GlobeCom" must not be used to
+#    endorse or promote products derived from this software without
+#    prior written permission. For written permission, please contact
+#    hpj@globecom.net.
+#
+# 5. Products derived from this software may not be called "GlobeCom
+#    Jukebox" nor may "GlobeCom" appear in their names without prior written
+#    permission of the GlobeCom GCAB AB.
+#
+# 6. Redistributions of any form whatsoever must retain the following
+#    acknowledgment:
+#    "This product includes software developed by GlobeCom GCAB AB
+#    <http://www.globecom.net/> for use in GlobeCom Jukebox."
+#
+# THIS SOFTWARE IS PROVIDED BY GLOBECOM GCAB AB ``AS IS'' AND ANY
+# EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL GLOBECOM GCAB AB OR
+# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+# OF THE POSSIBILITY OF SUCH DAMAGE.
+# ====================================================================
+
+$AUTH=2;
+
+header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
+header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
+header("Cache-Control: no-cache"); 
+header("Cache-Control: post-check=0,pre-check=0");
+header("Cache-Control: max-age=0");
+header("Pragma: no-cache");
+
+if (!$CONNECTED) {
+    include "connect.php";
+}
+?>
+<HTML>
+<HEAD>
+<?
+head("addgenre");
+?></HEAD><?
+body("addgenre");
+if($GENRE) $genre=prepareDB($GENRE);
+
+if($genre){
+	$result=mysql_query("select name from genre where name like $genre");
+	if(list($genre2)=mysql_fetch_array($result)){
+		?>
+                <center>
+                <H2>Genre Not Added</H2>
+                <?
+		print $genre." Is just like ".$genre2."<br><br>\n";
+                ?>
+                <table><tr><td>
+		<form action="javascript: window.close()">
+                <input TYPE=submit VALUE="Ok">
+                </form>
+                </TD><TD>
+		<form action="">
+                <input TYPE=submit VALUE="Try Again">
+                </form>
+		</TD></TR></TABLE>
+		</CENTER>
+                <?
+		}
+	else{
+		mysql_query("insert into genre (name) values ($genre)";
+		?>
+		<center>
+		<H2> Genre Added </H2>
+		<?
+		print $genre;
+		?>
+		<form action="javascript: window.close()">
+		<input TYPE=submit VALUE="Ok">
+		</form>
+		</CENTER>
+		<?
+		}
+	}
+else{
+	?>
+	<center>
+	<H2> Add Genre </H2>
+	<FORM action="">
+	<input TYPE=text NAME=GENRE><br>
+	<input TYPE=submit VALUE="ADD">
+	</form>
+	</center>
+	<?
+	}
+?>
+</BODY>
+</HTML>
diff -Naur 100402/gjukebox/www/program.php bugfix.offof100402/gjukebox/www/program.php
--- 100402/gjukebox/www/program.php	Thu Oct  3 06:25:11 2002
+++ bugfix.offof100402/gjukebox/www/program.php	Fri Oct  4 19:33:53 2002
@@ -466,7 +466,7 @@
 	  mysql_query("update programs set cover=null where id=$VIEW");
 	}
 	$googlestring=prepareDB($GOOGLESEARCH);
-	$res = mysql_query("insert into ripqueue values (0,NULL,'program','$TOID',$artist,$googlestring,$program,$VIEW,0,'$MUSICUSER',NULL,NULL)");
+	$res = mysql_query("insert into ripqueue (id,fromid,toid,artist,title,album,file,status,user) values (0,'program','$TOID',$artist,$googlestring,$program,$VIEW,0,'$MUSICUSER')");
     }
     if ($UPLOAD) { #Add a song to an album
         list($program,$artist)=mysql_fetch_array(mysql_query("select name,artist from programs where id = $UPLOAD"));
@@ -689,10 +689,11 @@
 	if ($burn) {
 	    if (!$nofit)
 	        print "<A HREF=program.php?FIT=$VIEW onMouseOver=\"self.status='Calculate best fit';return true\"><B>Maximize free space</B></A><P>";
-	    $res=mysql_query("select toid,description from transformations where fromid = 'program' and toid is not 'cover_art' order by description");
-	    while(list($toid,$dsc)=mysql_fetch_array($res)) {
-		print "<A HREF=program.php?UPLOAD=$VIEW&TOID=$toid onMouseOver=\"self.status='$dsc';return true\"><B>$dsc</B><P>";
-	    }
+	    if($res=mysql_query("select toid,description from transformations where fromid = 'program' and toid is not 'cover_art' order by description")){
+		while(list($toid,$dsc)=mysql_fetch_array($res)) {
+			print "<A HREF=program.php?UPLOAD=$VIEW&TOID=$toid onMouseOver=\"self.status='$dsc';return true\"><B>$dsc</B><P>";
+	    		}
+		}
 	}
 
 	if(!$cover) { # no cover art directory ? construct one from artist / album name. Must match the one made in getpictures.pl
