From: Michael Andreen Date: Tue, 16 Jan 2007 16:24:33 +0000 (+0000) Subject: switched to BBCode::Parser X-Git-Url: https://ruin.nu/git/?a=commitdiff_plain;ds=sidebyside;h=2490bcb7f2aebf5b2524e80be4685feac23b1fa0;p=ndwebbie.git switched to BBCode::Parser --- diff --git a/ND/Web/Include.pm b/ND/Web/Include.pm index ea7db46..220a781 100644 --- a/ND/Web/Include.pm +++ b/ND/Web/Include.pm @@ -22,6 +22,7 @@ use strict; use warnings FATAL => 'all'; use CGI qw{:standard}; require Exporter; +use BBCode::Parser; our @ISA = qw/Exporter/; @@ -63,11 +64,17 @@ sub isTech { sub parseMarkup { my ($text) = @_; - $text =~ s{\n}{\n
}g; - $text =~ s{\[B\](.*?)\[/B\]}{$1}gi; - $text =~ s{\[I\](.*?)\[/I\]}{$1}gi; - $text =~ s{\[url\](.*?)\[/url\]}{$1}gi; - return $text; + #$text =~ s{\n}{\n
}g; + #$text =~ s{\[B\](.*?)\[/B\]}{$1}gi; + #$text =~ s{\[I\](.*?)\[/I\]}{$1}gi; + #$text =~ s{\[url\](.*?)\[/url\]}{$1}gi; + #$text =~ s{\[PRE\](.*?)\[/PRE\]}{
$1
}sgi; + #$text =~ s{\[PRE\](.*?)\[/PRE\]}{
$1
}sgi; + #$1 =~ s{
}{}g; + + my $tree = BBCode::Parser->DEFAULT->parse($text); + + return scalar $tree->bodyHTML;; } diff --git a/ND/Web/Pages/Forum.pm b/ND/Web/Pages/Forum.pm index a54d23e..6cc441f 100644 --- a/ND/Web/Pages/Forum.pm +++ b/ND/Web/Pages/Forum.pm @@ -203,9 +203,6 @@ sub render { while (my $category = $categories->fetchrow_hashref){ $boards->execute($category->{id},$ND::UID) or $ND::ERROR .= p($DBH->errstr); #TODO: really need to do this outside, so you don't need moderate access - if ($category->{id} == $board->{fcid}){ - $BODY->param(Category => $category->{category}); - } my @boards; while (my $b = $boards->fetchrow_hashref){ @@ -219,6 +216,8 @@ sub render { } $BODY->param(Categories => \@categories); } + my ($category) = $DBH->selectrow_array(q{SELECT category FROM forum_categories WHERE fcid = $1} + ,undef,$board->{fcid}) or $ND::ERROR .= p($DBH->errstr); }else{ #List boards $BODY->param(Overview => 1); diff --git a/startup.pl b/startup.pl index 88a406a..39324ec 100644 --- a/startup.pl +++ b/startup.pl @@ -13,6 +13,8 @@ use DBD::Pg qw(:pg_types); use GD::Graph::lines; +use BBCode::Parser; + use ND; use ND::DB; use ND::Include; diff --git a/templates/viewthread.tmpl b/templates/viewthread.tmpl index 58be2c0..8086162 100644 --- a/templates/viewthread.tmpl +++ b/templates/viewthread.tmpl @@ -5,7 +5,7 @@
: - +