X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=ND%2FWeb%2FXMLPage.pm;h=0868ce1d829f33d16dead9b6bf25501eb28d713a;hb=c6a6e6dbab0ca435e6aeeb94e7c7329585b7b4f1;hp=2a876a4cbff879584af9340606726bedb4e5f183;hpb=571b019af4b9e3e051447f82135bb630a4fb4db8;p=ndwebbie.git diff --git a/ND/Web/XMLPage.pm b/ND/Web/XMLPage.pm index 2a876a4..0868ce1 100644 --- a/ND/Web/XMLPage.pm +++ b/ND/Web/XMLPage.pm @@ -54,7 +54,7 @@ ORDER BY r.tick+c.wave,x,y,z}); push @targets,{Coords => $coords, Launched => $target->{launched}, Raid => $target->{raid} , Target => $target->{id}, Tick => $target->{landingtick}, Wave => $target->{wave} , AJAX => $self->{AJAX}, JoinName => $target->{joinable} ? 'N' : 'J' - , Joinable => $target->{joinable} ? 'FALSE' : 'TRUE'}; + , Joinable => $target->{joinable} ? 'FALSE' : 'TRUE', JoinableTitle => $target->{joinable} ? 'Disable join' : 'Make target joinable'}; } my $template = HTML::Template->new(filename => "templates/targetlist.tmpl", cache => 1); $template->param(Targets => \@targets); @@ -80,6 +80,9 @@ sub render : method { $self->process; my $type = 'text/html'; + if ($self->{HTTP_ACCEPT} =~ m{application/xhtml\+xml}){ + $type = 'application/xhtml+xml' + } my $body; if ($self->{XML}){ $type = 'text/xml'; @@ -92,6 +95,10 @@ sub render : method { $body = $self->render_body($body); + unless ($body){ + return; + } + unless ($self->{XML}){ my $fleetupdate = $DBH->selectrow_array('SELECT landing_tick FROM fleets WHERE uid = ? AND fleet = 0',undef,$self->{UID}); @@ -118,18 +125,13 @@ sub render : method { my ($css) = $DBH->selectrow_array(q{SELECT css FROM users WHERE uid = $1},undef,$ND::UID); $template->param(CSS => $css); $template->param(TITLE => $self->{TITLE}); - } $template->param(Error => $ND::ERROR); $template->param(BODY => $body->output); my $output = $template->output; + $output =~ s/[^\x{9}\x{A}\x{D}\x{20}-\x{D7FF}\x{E000}-\x{FFFD}\x{10000}-\x{10FFFF}]//g; print header(-type=> $type, -charset => 'utf-8', -Content_Length => length $output); print $output; - - - $DBH->rollback unless $DBH->{AutoCommit}; - $DBH->disconnect; - }; 1;