summaryrefslogtreecommitdiffstats
path: root/blog
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-07-05 17:58:53 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-07-05 17:58:53 +0800
commit282b585f4f217d84007144877810b70ba2c6dd79 (patch)
treed7c223e819e23f8e9fd49e203a17aa075e6bbb71 /blog
parent7dccd92d061dad8d9ea97f3eb82dac7366ad9b42 (diff)
downloadpttbbs-282b585f4f217d84007144877810b70ba2c6dd79.tar
pttbbs-282b585f4f217d84007144877810b70ba2c6dd79.tar.gz
pttbbs-282b585f4f217d84007144877810b70ba2c6dd79.tar.bz2
pttbbs-282b585f4f217d84007144877810b70ba2c6dd79.tar.lz
pttbbs-282b585f4f217d84007144877810b70ba2c6dd79.tar.xz
pttbbs-282b585f4f217d84007144877810b70ba2c6dd79.tar.zst
pttbbs-282b585f4f217d84007144877810b70ba2c6dd79.zip
for comments
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@1031 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'blog')
-rwxr-xr-xblog/blog.pl20
1 files changed, 15 insertions, 5 deletions
diff --git a/blog/blog.pl b/blog/blog.pl
index b7f2dc5d..78885190 100755
--- a/blog/blog.pl
+++ b/blog/blog.pl
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-# $Id: blog.pl,v 1.26 2003/07/05 09:31:12 in2 Exp $
+# $Id: blog.pl,v 1.27 2003/07/05 09:58:53 in2 Exp $
use CGI qw/:standard/;
use lib qw/./;
use LocalVars;
@@ -14,11 +14,11 @@ use DBI;
use DBD::mysql;
use POSIX;
-use vars qw/@emonth @cnumber %config %attr %article %th $dbh/;
+use vars qw/@emonth @cnumber %config %attr %article %th $dbh $brdname/;
sub main
{
- my($brdname, $fn, $y, $m, $d);
+ my($fn, $y, $m, $d);
my($tmpl);
$dbh = undef;
@@ -227,7 +227,6 @@ sub main
# Comments ---------------------------------------------------------------
if( $attr{"$fn.loadRecentComments"} ){
- print "here\n";
dodbi(sub {
my($dbh) = @_;
my($sth, $t);
@@ -295,13 +294,23 @@ sub main
sub AddArticle($$$;$)
{
my($cl, $fields, $s, $score) = @_;
- my($content, $short) = ();
+ my($content, $short, $nComments) = ();
$content = applyfilter($article{"$s.content"}, $config{outputfilter})
if( $fields =~ /content/i );
$short = applyfilter($article{"$s.short"}, $config{outputfilter})
if( $fields =~ /short/i );
+ if( $fields =~ /nComments/i ){
+ $nComments = dodbi(sub {
+ my($dbh) = @_;
+ my $sth = $dbh->prepare("select count(*) from comment ".
+ "where brdname='$brdname'&&artid='$s'");
+ $sth->execute();
+ return $sth->fetchrow_hashref()->{'count(*)'};
+ }) || 0;
+ }
+
my($y, $m, $d) = unpackdate($s);
push @{$th{$cl}}, {year => $y,
month => $m,
@@ -316,6 +325,7 @@ sub AddArticle($$$;$)
$article{"$s.author"}),
short => $short,
score => $score,
+ nComments => $nComments,
}
if( $article{"$s.title"} );
}