#!c:/perl/bin/perl use CGI; use Globals; use Globals qw(@CUSTOM); use Globals qw($VERSION); use Globals qw($target); use Globals qw($bgcolour); use strict; my $QUERY = CGI::new(); my $WEBPAGE; # Source for the webpage will be written here my $CUSTOM; # Screw with the $target variable # $target =~ s/narrow/iframe/g; # Gather current user info # my $USER; my $HOST = $QUERY->remote_host(); open USERS, "../data/users.txt" or die; while( ) { if ( $_ =~ /$HOST/ ) { chomp; my @THISUSER = split (';'); $USER = "$THISUSER[1] ($THISUSER[0]/$THISUSER[2])"; } } close USERS; if (!defined $USER) { $USER = $HOST } # fill in custom folders foreach (@CUSTOM) { my $folder = $_; if ( length $CUSTOM > 0 ) { $CUSTOM .= ", "; } $CUSTOM.=''.$folder.""; } # decide the start page my $start; if (defined $QUERY->param('artist')) { if (defined $QUERY->param('album')) { $start="artist.plx?name=".makeUnNice($QUERY->param('artist'))."&album=".makeUnNice($QUERY->param('album')); } else { $start="search.plx?artist=".makeUnNice($QUERY->param('artist'))."&exact=0&searchFor=artist&output=tracks&filter=music,video,shortcut&scope=all"; } } else { $start = "news.plx"; $start = "servernews.plx" if ($QUERY->cookie('start') eq 'servernews'); } # load the headlines my $NEWS; if (open(NEWS, '../data/news.txt')) { while() { chomp; if (/^\[*(.*)\]$/) { $NEWS .= ', ' if ($NEWS); $NEWS.= ''.$1.''; } } } # put the iframe in if we're not small screen my $iframe = ''; if ($target ne '_top') { $iframe = ''; } # open the template file # $WEBPAGE = openTemplate("front"); # Put in what we know # $WEBPAGE =~ s/%IFRAME%/$iframe/g; $WEBPAGE =~ s/%TARGET%/$target/g; $WEBPAGE =~ s/%VERSION%/$VERSION/g; $WEBPAGE =~ s/%USER%/$USER/g; $WEBPAGE =~ s/%HOST%/$HOST/g; $WEBPAGE =~ s/%CUSTOM%/$CUSTOM/g; $WEBPAGE =~ s/%START%/$start/g; $WEBPAGE =~ s/%HEADLINES%/$NEWS/g; $WEBPAGE =~ s/%BGCOLOUR%/$bgcolour/g; # Display the finished Web page # print $WEBPAGE; # Fin # close TEMPLATE; exit;