]> ruin.nu Git - ndwebbie.git/commitdiff
switched to BBCode::Parser
authorMichael Andreen <harv@ruin.nu>
Tue, 16 Jan 2007 16:24:33 +0000 (16:24 +0000)
committerMichael Andreen <harv@ruin.nu>
Tue, 16 Jan 2007 16:24:33 +0000 (16:24 +0000)
ND/Web/Include.pm
ND/Web/Pages/Forum.pm
startup.pl
templates/viewthread.tmpl

index ea7db4690b05f85206a5453e285327f7bdc33f77..220a7819a6b772beb7ffaeeded7fb7f04032fe4e 100644 (file)
@@ -22,6 +22,7 @@ use strict;
 use warnings FATAL => 'all';
 use CGI qw{:standard};
 require Exporter;
 use warnings FATAL => 'all';
 use CGI qw{:standard};
 require Exporter;
+use BBCode::Parser;
 
 our @ISA = qw/Exporter/;
 
 
 our @ISA = qw/Exporter/;
 
@@ -63,11 +64,17 @@ sub isTech {
 sub parseMarkup {
        my ($text) = @_;
 
 sub parseMarkup {
        my ($text) = @_;
 
-       $text =~ s{\n}{\n<br/>}g;
-       $text =~ s{\[B\](.*?)\[/B\]}{<b>$1</b>}gi;
-       $text =~ s{\[I\](.*?)\[/I\]}{<i>$1</i>}gi;
-       $text =~ s{\[url\](.*?)\[/url\]}{<a href="$1">$1</a>}gi;
-       return $text;
+       #$text =~ s{\n}{\n<br/>}g;
+       #$text =~ s{\[B\](.*?)\[/B\]}{<b>$1</b>}gi;
+       #$text =~ s{\[I\](.*?)\[/I\]}{<i>$1</i>}gi;
+       #$text =~ s{\[url\](.*?)\[/url\]}{<a href="$1">$1</a>}gi;
+       #$text =~ s{\[PRE\](.*?)\[/PRE\]}{<pre>$1</pre>}sgi;
+       #$text =~ s{\[PRE\](.*?)\[/PRE\]}{<pre>$1</pre>}sgi;
+       #$1 =~ s{<br/>}{}g;
+
+       my $tree = BBCode::Parser->DEFAULT->parse($text);
+
+       return scalar $tree->bodyHTML;;
 }
 
 
 }
 
 
index a54d23e42eca8188eb07e6b0be8383ef5e5094e1..6cc441f87ff1af732438a923aac4392202b894f0 100644 (file)
@@ -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
                        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){
 
                                my @boards;
                                while (my $b = $boards->fetchrow_hashref){
@@ -219,6 +216,8 @@ sub render {
                        }
                        $BODY->param(Categories => \@categories);
                }
                        }
                        $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);
 
        }else{ #List boards
                $BODY->param(Overview => 1);
index 88a406a1b1445c3ea7a053dbc59b7f6fd5825067..39324ece3294ca663b66202cddb61c6fe5285a9e 100644 (file)
@@ -13,6 +13,8 @@ use DBD::Pg qw(:pg_types);
 
 use GD::Graph::lines;
 
 
 use GD::Graph::lines;
 
+use BBCode::Parser;
+
 use ND;
 use ND::DB;
 use ND::Include;
 use ND;
 use ND::DB;
 use ND::Include;
index 58be2c06f43ed5f0e8493e65dfc4a8c95a789e3e..8086162273c7f7c4e04772555f2b80d959964ff7 100644 (file)
@@ -5,7 +5,7 @@
 </TMPL_IF>
 <fieldset class="forum-post">
 <legend class="unread:<TMPL_VAR NAME=Unread>"><b><TMPL_VAR NAME=Username></b> : <TMPL_VAR NAME=Time></legend>
 </TMPL_IF>
 <fieldset class="forum-post">
 <legend class="unread:<TMPL_VAR NAME=Unread>"><b><TMPL_VAR NAME=Username></b> : <TMPL_VAR NAME=Time></legend>
-<TMPL_VAR NAME=Message>
+       <TMPL_VAR NAME=Message>
 </fieldset>
 </TMPL_LOOP>
 <TMPL_IF Post>
 </fieldset>
 </TMPL_LOOP>
 <TMPL_IF Post>