Update of /cvs/scoop/scoop/lib/Scoop
In directory lithium.sabren.com:/tmp/cvs-serv14403
Modified Files:
Tags.pm
Log Message:
A couple of minor code changes to Tags.pm that have been in production
use on DailyKos for a few months or so. -j
Index: Tags.pm
===================================================================
RCS file: /cvs/scoop/scoop/lib/Scoop/Tags.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Tags.pm 10 Sep 2005 01:13:45 -0000 1.1
--- Tags.pm 8 Jan 2006 05:44:03 -0000 1.2
***************
*** 85,90 ****
my @cache;
foreach my $tag (@tags) {
my $q_tag = $S->dbh->quote($tag);
!
my ($rv, $sth) = $S->db_insert({
INTO => 'story_tags',
--- 85,93 ----
my @cache;
foreach my $tag (@tags) {
+ # this ought to block blank tags
+ next if $tag !~ /\w/;
my $q_tag = $S->dbh->quote($tag);
! # gotta filter out '/' as '-', too
! $q_tag =~ s#/#-#g;
my ($rv, $sth) = $S->db_insert({
INTO => 'story_tags',
***************
*** 217,220 ****
--- 220,226 ----
my $fetch;
my $sort = $S->pref('tag_sort') eq 'count' ? 'c desc' : 'tag asc';
+ if ($S->{UID} < 0){
+ $sort = $S->session('tag_sort') eq 'count' ? 'c desc' : 'tag asc';
+ }
$fetch = {
***************
*** 273,277 ****
foreach my $tag (@{$list}) {
my $cssclass; # This is where we store the class to use
! foreach my $threshold (sort keys %$classes) {
$cssclass=$classes->{$threshold} if $tag->{'c'} >= $threshold;
}
--- 279,283 ----
foreach my $tag (@{$list}) {
my $cssclass; # This is where we store the class to use
! foreach my $threshold (sort { $a <=> $b } keys %$classes) {
$cssclass=$classes->{$threshold} if $tag->{'c'} >= $threshold;
}