[% END # IF !user.is_anon || constants.allow_anonymous %]
@@ -67,4 +73,4 @@
__seclev__
1000
__version__
-$Id: edit_comment;ajax;default,v 1.1 2008/02/28 21:39:31 pudge Exp $
+$Id: edit_comment;ajax;default,v 1.5 2008/03/19 08:25:31 pudge Exp $
Modified: slashjp/branches/upstream/current/plugins/Ajax/templates/prefs_d2;ajax;default
===================================================================
--- slashjp/branches/upstream/current/plugins/Ajax/templates/prefs_d2;ajax;default 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/plugins/Ajax/templates/prefs_d2;ajax;default 2008-04-01 03:35:14 UTC (rev 560)
@@ -42,7 +42,6 @@
[% IF user.discussion2 && user.discussion2 == "slashdot" %]
-
@@ -97,11 +95,11 @@
Show the actual domain of any link in brackets.
@@ -112,4 +110,4 @@
__seclev__
500
__version__
-$Id: prefs_d2;ajax;default,v 1.12 2008/02/28 17:03:12 entweichen Exp $
+$Id: prefs_d2;ajax;default,v 1.13 2008/03/12 14:14:59 entweichen Exp $
Modified: slashjp/branches/upstream/current/plugins/Email/templates/dispStory;email;default
===================================================================
--- slashjp/branches/upstream/current/plugins/Email/templates/dispStory;email;default 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/plugins/Email/templates/dispStory;email;default 2008-04-01 03:35:14 UTC (rev 560)
@@ -56,7 +56,7 @@
To opt-out of further emailings:
[% thisurl %]/email.pl?op=optout_form
-Copyright 1997-2005 [% constants.sitepublisher %]. All rights reserved.
+Copyright 1997-2008 [% constants.sitepublisher %]. All rights reserved.
__version__
-$Id: dispStory;email;default,v 1.9 2005/03/30 23:41:45 pudge Exp $
+$Id: dispStory;email;default,v 1.10 2008/03/13 14:22:37 entweichen Exp $
Modified: slashjp/branches/upstream/current/plugins/FAQSlashdot/faq/friends.shtml
===================================================================
--- slashjp/branches/upstream/current/plugins/FAQSlashdot/faq/friends.shtml 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/plugins/FAQSlashdot/faq/friends.shtml 2008-04-01 03:35:14 UTC (rev 560)
@@ -3,18 +3,25 @@
Slashdot FAQ - Friends and Journals
-
+
-
-
-
+
+
+
Friends and Journals
+
+
+
+
Your journal can be found at http://slashdot.org/my/journal.
Modified: slashjp/branches/upstream/current/plugins/FireHose/FireHose.pm
===================================================================
--- slashjp/branches/upstream/current/plugins/FireHose/FireHose.pm 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/plugins/FireHose/FireHose.pm 2008-04-01 03:35:14 UTC (rev 560)
@@ -1,7 +1,7 @@
# This code is a part of Slash, and is released under the GPL.
# Copyright 1997-2005 by Open Source Technology Group. See README
# and COPYING for more information, or see http://slashcode.com/.
-# $Id: FireHose.pm,v 1.223 2008/02/27 02:37:05 tvroom Exp $
+# $Id: FireHose.pm,v 1.226 2008/03/18 16:16:02 tvroom Exp $
package Slash::FireHose;
@@ -41,7 +41,7 @@
use base 'Slash::DB::MySQL';
use vars qw($VERSION);
-($VERSION) = ' $Revision: 1.223 $ ' =~ /\$Revision:\s+([^\s]+)/;
+($VERSION) = ' $Revision: 1.226 $ ' =~ /\$Revision:\s+([^\s]+)/;
sub createFireHose {
my($self, $data) = @_;
$data->{dept} ||= "";
@@ -561,7 +561,7 @@
push @where, "popularity >= $pop_q";
}
}
- if ($user->{is_admin}) {
+ if ($user->{is_admin} || $user->{acl}{signoff_allowed}) {
my $signoff_label = 'sign' . $user->{uid} . 'ed';
if ($options->{unsigned}) {
@@ -1124,7 +1124,7 @@
my $newtagspreloadtext = join ' ', @newtagspreload;
#print STDERR "ajaxGetUserFirehose $newtagspreloadtext\n\n";
- return slashDisplay('tagsfirehosedivuser', {
+ return slashDisplay($form->{nodnix} ? 'tagsnodnixuser' : 'tagsfirehosedivuser', {
id => $id,
newtagspreloadtext => $newtagspreloadtext,
}, { Return => 1 });
@@ -1516,9 +1516,13 @@
}
+# Return a positive number if data was altered, 0 if it was not,
+# or undef on error.
+
sub setFireHose {
my($self, $id, $data) = @_;
- return unless $id && $data;
+ return undef unless $id && $data;
+ return 0 if !%$data;
my $id_q = $self->sqlQuote($id);
my $mcd = $self->getMCD();
@@ -1547,7 +1551,7 @@
$self->setGlobjAdminnote($globjid, $note);
}
- return if !keys %$data;
+ return 0 if !keys %$data;
my $text_data = {};
@@ -1556,9 +1560,11 @@
$text_data->{bodytext} = delete $data->{bodytext} if exists $data->{bodytext};
$text_data->{media} = delete $data->{media} if exists $data->{media};
- $self->sqlUpdate('firehose', $data, "id=$id_q");
- $self->sqlUpdate('firehose_text', $text_data, "id=$id_q") if keys %$text_data;
-
+ my $rows = $self->sqlUpdate('firehose', $data, "id=$id_q");
+#{ use Data::Dumper; my $dstr = Dumper($data); $dstr =~ s/\s+/ /g; print STDERR "setFireHose A rows=$rows for id=$id_q data: $dstr\n"; }
+ $rows += $self->sqlUpdate('firehose_text', $text_data, "id=$id_q") if keys %$text_data;
+#{ use Data::Dumper; my $dstr = Dumper($text_data); $dstr =~ s/\s+/ /g; print STDERR "setFireHose B rows=$rows for id=$id_q data: $dstr\n"; }
+
if ($mcd) {
$mcd->delete("$mcdkey:$id", 3);
}
@@ -1570,6 +1576,8 @@
# $status = 'deleted' if $data->{accepted} eq 'yes' || $data->{rejected} eq 'yes';
$searchtoo->storeRecords(firehose => $id, { $status => 1 });
}
+
+ return $rows;
}
sub dispFireHose {
@@ -1595,6 +1603,9 @@
return [] unless $item && $user->{is_admin};
my $subnotes_ref = [];
my $sub_memory = $self->getSubmissionMemory();
+ my $url = "";
+ $url = $self->getUrl($item->{url_id}) if $item->{url_id};
+
foreach my $memory (@$sub_memory) {
my $match = $memory->{submatch};
@@ -1602,7 +1613,8 @@
$item->{name} =~ m/$match/i ||
$item->{title} =~ m/$match/i ||
$item->{ipid} =~ m/$match/i ||
- $item->{introtext} =~ m/$match/i) {
+ $item->{introtext} =~ m/$match/i ||
+ $url =~ m/$match/i) {
push @$subnotes_ref, $memory;
}
}
@@ -2625,4 +2637,4 @@
=head1 VERSION
-$Id: FireHose.pm,v 1.223 2008/02/27 02:37:05 tvroom Exp $
+$Id: FireHose.pm,v 1.226 2008/03/18 16:16:02 tvroom Exp $
Modified: slashjp/branches/upstream/current/plugins/FireHose/PLUGIN
===================================================================
--- slashjp/branches/upstream/current/plugins/FireHose/PLUGIN 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/plugins/FireHose/PLUGIN 2008-04-01 03:35:14 UTC (rev 560)
@@ -1,4 +1,4 @@
-# $Id: PLUGIN,v 1.29 2008/02/19 14:45:30 scc Exp $
+# $Id: PLUGIN,v 1.30 2008/03/03 14:11:11 scc Exp $
name=FireHose
description="FireHose"
css=firehose.css
@@ -32,6 +32,7 @@
template=templates/tagsfirehosedivadmin;misc;default
template=templates/tagsfirehosedivtagbox;misc;default
template=templates/tagsfirehosedivuser;misc;default
+template=templates/tagsnodnixuser;misc;default
task=firehose_reject_old.pl
task=firehose_backend.pl
task=firehose_get_thumbnails.pl
Modified: slashjp/branches/upstream/current/plugins/FireHose/firehose.css
===================================================================
--- slashjp/branches/upstream/current/plugins/FireHose/firehose.css 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/plugins/FireHose/firehose.css 2008-04-01 03:35:14 UTC (rev 560)
@@ -449,9 +449,15 @@
.embed #nod-user-tags, #console #nod-input {left: 63px !important;}
.embed #nix-user-tags, #console #nix-input {left: 68px !important;}
.embed #nodmenu ul, #console #nodmenu ul {margin: 0 0 0 43px; background: #222; opacity: .9; border: 1px solid #111;}
-ol#nod-hardened, ol#nix-hardened, ol#nod-hardened li, ol#nix-hardened li {background: black !important;}
-ol#nod-hardened, ol#nix-hardened {margin-left: 0 !important; padding-left: 0 !important;}
+ol#nod-hardened, ol#nix-hardened, ol#nod-hardened li, ol#nix-hardened li {position: relative; background: black !important;}
+ol#nod-hardened, ol#nix-hardened {margin-left: 0 !important; padding-left: 0 !important; cursor: pointer;}
+.tag-actions {display: none; position: absolute; opacity: 0.6; top: -0.75em; right: 0; width: 1.5em; font-size: 120%; text-align: center; color: black; background-color: white; -moz-border-radius: 0.1em; -webkit-border-radius: 0.1em;}
+a.not-tag, a.del-tag {text-decoration: none;}
+li:hover .tag-actions {display: inline;}
+li .tag-actions:hover {opacity: 0.9;}
+li .tag-actions .not-tag:hover, li .tag-actions .del-tag:hover {color: red;}
+
.article .title, .article h3, .article .generaltitle {border: none !important}
.article .generaltitle, #firehoselist .article .title, .article h3 {line-height: 170% !important;}
.briefarticle .generaltitle, .briefarticle .title, .briefarticle h3 {line-height: 160% !important;}
Modified: slashjp/branches/upstream/current/plugins/FireHose/templates/firehose_tags_top;misc;default
===================================================================
--- slashjp/branches/upstream/current/plugins/FireHose/templates/firehose_tags_top;misc;default 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/plugins/FireHose/templates/firehose_tags_top;misc;default 2008-04-01 03:35:14 UTC (rev 560)
@@ -26,7 +26,7 @@
[%- END -%]
[%- tags_seen.${parts.0} = 1 -%]
[%- END -%]
- [%- IF item.type == "story" -%][% IF user.is_admin %][% PROCESS signoff stoid=item.srcid fhid = item.id %][% END %][% END %]
+ [%- IF item.type == "story" -%][% IF user.is_admin || user.acl.signoff_allowed %][% PROCESS signoff stoid=item.srcid fhid = item.id %][% END %][% END %]
[% IF item.type == "feed" && user.is_admin %]
[% feed_user = Slash.db.getUser(item.uid, "nickname"); %]
[% feed_user | strip_literal %]
@@ -35,4 +35,4 @@
__seclev__
10000
__version__
-$Id: firehose_tags_top;misc;default,v 1.22 2007/08/22 20:26:14 scc Exp $
+$Id: firehose_tags_top;misc;default,v 1.23 2008/03/18 16:16:02 tvroom Exp $
Added: slashjp/branches/upstream/current/plugins/FireHose/templates/tagsnodnixuser;misc;default
===================================================================
--- slashjp/branches/upstream/current/plugins/FireHose/templates/tagsnodnixuser;misc;default (rev 0)
+++ slashjp/branches/upstream/current/plugins/FireHose/templates/tagsnodnixuser;misc;default 2008-04-01 03:35:14 UTC (rev 560)
@@ -0,0 +1,23 @@
+__section__
+default
+__description__
+id = id
+newtagspreloadtext = text to preload the newtags-# field with
+
+WARNING: keep the related string in nodnix.js in sync with the expansion, below
+__title__
+
+__page__
+misc
+__lang__
+en_US
+__name__
+tagsnodnixuser
+__template__
+[% FOREACH tag = newtagspreloadtext.split(' ') %]
+[% tag %]! x
+[% END %]
+__seclev__
+10000
+__version__
+$Id: tagsnodnixuser;misc;default,v 1.4 2008/03/03 20:54:00 scc Exp $
Modified: slashjp/branches/upstream/current/plugins/Messages/templates/dailyheadlines;messages;default
===================================================================
--- slashjp/branches/upstream/current/plugins/Messages/templates/dailyheadlines;messages;default 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/plugins/Messages/templates/dailyheadlines;messages;default 2008-04-01 03:35:14 UTC (rev 560)
@@ -25,9 +25,9 @@
[% END %]
-Copyright 1997-2007 [% constants.sitepublisher %]. All rights reserved.
+Copyright 1997-2008 [% constants.sitepublisher %]. All rights reserved.
__seclev__
500
__version__
-$Id: dailyheadlines;messages;default,v 1.13 2007/01/02 18:35:59 cowboyneal Exp $
+$Id: dailyheadlines;messages;default,v 1.14 2008/03/13 14:13:18 entweichen Exp $
Modified: slashjp/branches/upstream/current/plugins/Messages/templates/dailynews;messages;default
===================================================================
--- slashjp/branches/upstream/current/plugins/Messages/templates/dailynews;messages;default 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/plugins/Messages/templates/dailynews;messages;default 2008-04-01 03:35:14 UTC (rev 560)
@@ -52,9 +52,9 @@
[% END %]
-Copyright 1997-2006 [% constants.sitepublisher %]. All rights reserved.
+Copyright 1997-2008 [% constants.sitepublisher %]. All rights reserved.
__seclev__
500
__version__
-$Id: dailynews;messages;default,v 1.14 2006/01/25 16:11:42 cowboyneal Exp $
+$Id: dailynews;messages;default,v 1.15 2008/03/13 14:14:08 entweichen Exp $
Modified: slashjp/branches/upstream/current/plugins/Moderation/Moderation.pm
===================================================================
--- slashjp/branches/upstream/current/plugins/Moderation/Moderation.pm 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/plugins/Moderation/Moderation.pm 2008-04-01 03:35:14 UTC (rev 560)
@@ -1,7 +1,7 @@
# This code is a part of Slash, and is released under the GPL.
# Copyright 1997-2005 by Open Source Technology Group. See README
# and COPYING for more information, or see http://slashcode.com/.
-# $Id: Moderation.pm,v 1.4 2008/02/21 01:01:52 pudge Exp $
+# $Id: Moderation.pm,v 1.9 2008/03/19 08:25:31 pudge Exp $
package Slash::Moderation;
@@ -17,7 +17,7 @@
use base 'Slash::DB::Utility';
use base 'Slash::DB::MySQL';
-($VERSION) = ' $Revision: 1.4 $ ' =~ /\$Revision:\s+([^\s]+)/;
+($VERSION) = ' $Revision: 1.9 $ ' =~ /\$Revision:\s+([^\s]+)/;
sub new {
my($class, $user) = @_;
@@ -91,10 +91,12 @@
$self->countUsers({ max => 1 }), $self->getReasons
);
- $html->{$score} = "(Score:$points";
+ $html->{$score} = "Score:$points";
+ $html->{$score} = qq[$html->{$score}]
+ if $constants->{modal_prefs_active} && !$user->{is_anon};
$html->{$score} .= ", $reasons->{$comment->{reason}}{name}"
if $comment->{reason} && $reasons->{$comment->{reason}};
- $html->{$score} .= ")";
+ $html->{$score} = "($html->{$score})";
my $ptstr = $user->{points} == 1 ? 'point' : 'points';
$html->{$select} = "Moderated '$reasons->{$reason}{name}.' $user->{points} $ptstr left.";
Modified: slashjp/branches/upstream/current/plugins/Rating/Rating.pm
===================================================================
--- slashjp/branches/upstream/current/plugins/Rating/Rating.pm 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/plugins/Rating/Rating.pm 2008-04-01 03:35:14 UTC (rev 560)
@@ -1,7 +1,7 @@
# This code is a part of Slash, and is released under the GPL.
# Copyright 1997-2005 by Open Source Technology Group. See README
# and COPYING for more information, or see http://slashcode.com/.
-# $Id: Rating.pm,v 1.7 2005/03/11 19:58:12 pudge Exp $
+# $Id: Rating.pm,v 1.8 2008/03/19 08:25:31 pudge Exp $
package Slash::Rating;
@@ -16,7 +16,7 @@
use base 'Slash::DB::Utility';
use base 'Slash::DB::MySQL';
-($VERSION) = ' $Revision: 1.7 $ ' =~ /\$Revision:\s+([^\s]+)/;
+($VERSION) = ' $Revision: 1.8 $ ' =~ /\$Revision:\s+([^\s]+)/;
#Right, this is not needed at the moment but will be in the near future
sub new {
@@ -52,13 +52,13 @@
my $extras;
$extras = $slashdb->getNexusExtrasForChosen({$disc_skin->{nexus} => 1}, {content_type => "comment"}) if $disc_skin && $disc_skin->{nexus};
- return unless $extras;
+ return 0 unless $extras;
foreach my $extra(@$extras) {
$can_create_vote=1 if $extra->[1] eq "comment_vote";
}
- return unless $can_create_vote;
+ return 0 unless $can_create_vote;
my $active = "yes";
my $val = 0;
Modified: slashjp/branches/upstream/current/plugins/ResKey/mysql_dump.sql
===================================================================
--- slashjp/branches/upstream/current/plugins/ResKey/mysql_dump.sql 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/plugins/ResKey/mysql_dump.sql 2008-04-01 03:35:14 UTC (rev 560)
@@ -1,5 +1,5 @@
#
-# $Id: mysql_dump.sql,v 1.20 2007/11/01 20:35:19 jamiemccarthy Exp $
+# $Id: mysql_dump.sql,v 1.21 2008/03/19 21:09:47 pudge Exp $
#
### NOTE: reserved reskey IDs:
@@ -54,7 +54,7 @@
INSERT INTO reskey_resource_checks VALUES (NULL, 1, 'all', 'Slash::ResKey::Checks::AL2::NoPost', 501);
INSERT INTO reskey_resource_checks VALUES (NULL, 1, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531);
INSERT INTO reskey_resource_checks VALUES (NULL, 1, 'all', 'Slash::ResKey::Checks::Duration', 601);
-INSERT INTO reskey_resource_checks VALUES (NULL, 1, 'use', 'Slash::ResKey::Checks::ProxyScan', 1001);
+#INSERT INTO reskey_resource_checks VALUES (NULL, 1, 'use', 'Slash::ResKey::Checks::ProxyScan', 1001);
# dummy example of how to disable the Slash::ResKey::Checks::User check for "touch"
# (maybe, for example, because the check isn't needed)
@@ -66,8 +66,8 @@
INSERT INTO reskey_vars VALUES (1, 'user_seclev', 0, 'Minimum seclev to use resource');
INSERT INTO reskey_vars VALUES (1, 'duration_max-uses', 30, 'how many uses per timeframe');
INSERT INTO reskey_vars VALUES (1, 'duration_max-failures', 10, 'how many failures per reskey');
-INSERT INTO reskey_vars VALUES (1, 'duration_uses', 120, 'min duration (in seconds) between uses');
-INSERT INTO reskey_vars VALUES (1, 'duration_creation-use', 5, 'min duration between (in seconds) creation and use');
+INSERT INTO reskey_vars VALUES (1, 'duration_uses', 60, 'min duration (in seconds) between uses');
+INSERT INTO reskey_vars VALUES (1, 'duration_creation-use', 10, 'min duration between (in seconds) creation and use');
Modified: slashjp/branches/upstream/current/plugins/Submit/submit.pl
===================================================================
--- slashjp/branches/upstream/current/plugins/Submit/submit.pl 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/plugins/Submit/submit.pl 2008-04-01 03:35:14 UTC (rev 560)
@@ -2,7 +2,7 @@
# This code is a part of Slash, and is released under the GPL.
# Copyright 1997-2005 by Open Source Technology Group. See README
# and COPYING for more information, or see http://slashcode.com/.
-# $Id: submit.pl,v 1.144 2007/10/23 20:56:46 tvroom Exp $
+# $Id: submit.pl,v 1.145 2008/03/18 16:45:13 tvroom Exp $
use strict;
use Slash 2.003; # require Slash 2.3.x
@@ -265,6 +265,9 @@
}
}
+ my $url = "";
+ $url = $slashdb->getUrl($sub->{url_id}) if $sub->{url_id};
+
foreach my $memory (@$sub_memory) {
my $match = $memory->{submatch};
@@ -272,7 +275,8 @@
$sub->{name} =~ m/$match/i ||
$sub->{subj} =~ m/$match/i ||
$sub->{ipid} =~ m/$match/i ||
- $sub->{story} =~ m/$match/i) {
+ $sub->{story} =~ m/$match/i ||
+ $url =~ m/$match/i ) {
push @$subnotes_ref, $memory;
}
}
Modified: slashjp/branches/upstream/current/plugins/TagModeration/TagModeration.pm
===================================================================
--- slashjp/branches/upstream/current/plugins/TagModeration/TagModeration.pm 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/plugins/TagModeration/TagModeration.pm 2008-04-01 03:35:14 UTC (rev 560)
@@ -1,7 +1,7 @@
# This code is a part of Slash, and is released under the GPL.
# Copyright 1997-2005 by Open Source Technology Group. See README
# and COPYING for more information, or see http://slashcode.com/.
-# $Id: TagModeration.pm,v 1.5 2008/02/21 01:01:52 pudge Exp $
+# $Id: TagModeration.pm,v 1.10 2008/03/19 08:25:31 pudge Exp $
package Slash::TagModeration;
@@ -17,7 +17,7 @@
use base 'Slash::DB::Utility';
use base 'Slash::DB::MySQL';
-($VERSION) = ' $Revision: 1.5 $ ' =~ /\$Revision:\s+([^\s]+)/;
+($VERSION) = ' $Revision: 1.10 $ ' =~ /\$Revision:\s+([^\s]+)/;
sub new {
my($class, $user) = @_;
@@ -91,10 +91,12 @@
$self->countUsers({ max => 1 }), $self->getReasons
);
- $html->{$score} = "(Score:$points";
+ $html->{$score} = "Score:$points";
+ $html->{$score} = qq[$html->{$score}]
+ if $constants->{modal_prefs_active} && !$user->{is_anon};
$html->{$score} .= ", $reasons->{$comment->{reason}}{name}"
if $comment->{reason} && $reasons->{$comment->{reason}};
- $html->{$score} .= ")";
+ $html->{$score} = "($html->{$score})";
my $ptstr = $user->{points} == 1 ? 'point' : 'points';
$html->{$select} = "Moderated '$reasons->{$reason}{name}.' $user->{points} $ptstr left.";
Modified: slashjp/branches/upstream/current/plugins/Tags/PLUGIN
===================================================================
--- slashjp/branches/upstream/current/plugins/Tags/PLUGIN 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/plugins/Tags/PLUGIN 2008-04-01 03:35:14 UTC (rev 560)
@@ -1,4 +1,4 @@
-# $Id: PLUGIN,v 1.14 2007/12/06 02:49:31 jamiemccarthy Exp $
+# $Id: PLUGIN,v 1.15 2008/03/19 14:49:35 jamiemccarthy Exp $
name=Tags
description="Tags"
htdoc=tags.pl
@@ -6,6 +6,7 @@
mysql_schema=mysql_schema.sql
requiresplugin=Ajax
task=tagbox.pl
+task=tags_tagnamecache.pl
task=tags_udc.pl
task=tags_updateclouts.pl
template=templates/data;tags;default
Modified: slashjp/branches/upstream/current/plugins/Tags/Tags.pm
===================================================================
--- slashjp/branches/upstream/current/plugins/Tags/Tags.pm 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/plugins/Tags/Tags.pm 2008-04-01 03:35:14 UTC (rev 560)
@@ -1,7 +1,7 @@
# This code is a part of Slash, and is released under the GPL.
# Copyright 1997-2005 by Open Source Technology Group. See README
# and COPYING for more information, or see http://slashcode.com/.
-# $Id: Tags.pm,v 1.101 2008/02/28 19:51:01 jamiemccarthy Exp $
+# $Id: Tags.pm,v 1.107 2008/03/19 14:49:35 jamiemccarthy Exp $
package Slash::Tags;
@@ -17,7 +17,7 @@
use base 'Slash::DB::Utility';
use base 'Slash::DB::MySQL';
-($VERSION) = ' $Revision: 1.101 $ ' =~ /\$Revision:\s+([^\s]+)/;
+($VERSION) = ' $Revision: 1.107 $ ' =~ /\$Revision:\s+([^\s]+)/;
# FRY: And where would a giant nerd be? THE LIBRARY!
@@ -603,6 +603,9 @@
}
# Is it descriptive?
+ # XXX this should be optimized by retrieving the list of _all_
+ # descriptive tagnames in memcached or the local closure and
+ # doing a lookup on that.
if ($types->{describe} && !$clid) {
$tn_data = $self->getTagnameDataFromId($tagnameid);
$clid = $types->{describe} if $tn_data->{descriptive};
@@ -685,7 +688,8 @@
for my $uid (keys %uid) {
# XXX getUser($foo, 'clout') does not work at the moment,
# so getUser($foo)->{clout} is used instead
- $user_clout_hr->{$uid} = $self->getUser($uid)->{clout};
+ my $user = $self->getUser($uid);
+ $user_clout_hr->{$uid} = $self->getUser($uid)->{clout} if $user;
}
@@ -704,7 +708,9 @@
$tagname_clid = $default_clout_clid;
}
my $tagname_clout_name = $clout_types->{ $tagname_clid };
- $tag_hr->{user_clout} = $mult * $user_clout_hr ->{$tag_hr->{uid}}{$tagname_clout_name};
+ my $clout = $user_clout_hr->{$tag_hr->{uid}};
+ my $clout_specific = $clout ? $clout->{$tagname_clout_name} : 0;
+ $tag_hr->{user_clout} = $mult * $clout_specific;
$tag_hr->{total_clout} = $tag_hr->{tag_clout} * $tag_hr->{tagname_clout} * $tag_hr->{user_clout};
}
}
@@ -849,7 +855,7 @@
# my $value = $mcd->get("$mcdkey$name");
# return $value if defined $value;
# }
- my $private_clause = $options->{include_private} ? '' : " AND private='no'";
+ my $private_clause = ref($options) && $options->{include_private} ? '' : " AND private='no'";
my $id = $self->getTagnameidFromNameIfExists($name);
return [ ] if !$id;
my $hr_ar = $self->sqlSelectAllHashrefArray(
@@ -965,7 +971,7 @@
my($self, $constants, $user, $form) = @_;
my $sidenc = $form->{sidenc};
- my $sid = $sidenc; $sid =~ tr{:}{/};
+ my $sid = $sidenc; $sid =~ tr{-}{/};
my $stoid = $self->getStoidFromSid($sid);
my $tags_reader = getObject('Slash::Tags', { db_type => 'reader' });
#print STDERR scalar(localtime) . " ajaxGetUserStory for stoid=$stoid sidenc=$sidenc tr=$tags_reader\n";
@@ -1023,7 +1029,7 @@
sub ajaxGetAdminStory {
my($slashdb, $constants, $user, $form) = @_;
my $sidenc = $form->{sidenc};
- my $sid = $sidenc; $sid =~ tr{:}{/};
+ my $sid = $sidenc; $sid =~ tr{-}{/};
if (!$sid || $sid !~ regexSid() || !$user->{is_admin}) {
return getData('error', {}, 'tags');
@@ -1155,7 +1161,7 @@
sub ajaxCreateForStory {
my($slashdb, $constants, $user, $form) = @_;
my $sidenc = $form->{sidenc};
- my $sid = $sidenc; $sid =~ tr{:}{/};
+ my $sid = $sidenc; $sid =~ tr{-}{/};
my $tags = getObject('Slash::Tags');
my $tagsstring = $form->{tags};
if (!$sid || $sid !~ regexSid() || $user->{is_anon} || !$tags) {
@@ -1189,6 +1195,30 @@
return $retval;
}
+sub ajaxDeactivateTag {
+ my($self, $constants, $user, $form) = @_;
+ my $type = $form->{type} || "stories";
+ my $tags = getObject('Slash::Tags'); # XXX isn't this the same as $self? -Jamie
+
+ my ($table, $id);
+
+ if ($type eq "firehose") {
+ my $firehose = getObject("Slash::FireHose");
+ my $item = $firehose->getFireHose($form->{id});
+ ($table, $id) = $tags->getGlobjTarget($item->{globjid});
+ } else {
+ # XXX doesn't work yet for stories or urls
+ return;
+ }
+
+ $tags->deactivateTag({
+ uid => $user->{uid},
+ name => $form->{tag},
+ table => $table,
+ id => $id,
+ });
+}
+
sub ajaxProcessAdminTags {
my($slashdb, $constants, $user, $form) = @_;
#print STDERR "ajaxProcessAdminTags\n";
@@ -1197,7 +1227,7 @@
my($id, $table, $sid, $sidenc, $itemid);
if ($type eq "stories") {
$sidenc = $form->{sidenc};
- $sid = $sidenc; $sid =~ tr{:}{/};
+ $sid = $sidenc; $sid =~ tr{-}{/};
$id = $slashdb->getStoidFromSid($sid);
$table = "stories";
} elsif ($type eq "urls") {
@@ -1293,7 +1323,7 @@
my $table;
if ($form->{type} eq "stories") {
my $sidenc = $form->{sidenc};
- my $sid = $sidenc; $sid =~ tr{:}{/};
+ my $sid = $sidenc; $sid =~ tr{-}{/};
$id = $slashdb->getStoidFromSid($sid);
$table = "stories"
} elsif ($form->{type} eq "urls") {
@@ -1380,6 +1410,13 @@
my $len = length($prefix);
my $notize = $form->{prefix} =~ /^([-!])/ ? $1 : '';
+ my $minlen = $constants->{tags_prefixlist_minlen} || 3;
+ if ($len < $minlen) {
+ # Too short to give a meaningful suggestion, and the
+ # shorter the prefix the longer the DB query takes.
+ return '';
+ }
+
my $tnhr = $tags_reader->listTagnamesByPrefix($prefix);
my @priority =
@@ -1683,10 +1720,10 @@
sub listTagnamesActive {
my($self, $options) = @_;
my $constants = getCurrentStatic();
- my $max_num = $options->{max_num} || 100;
- my $seconds = $options->{seconds} || (3600*6);
- my $include_private = $options->{include_private} || 0;
- my $min_slice = $options->{min_slice} || 0;
+ my $max_num = ref($options) && $options->{max_num} || 100;
+ my $seconds = ref($options) && $options->{seconds} || (3600*6);
+ my $include_private = ref($options) && $options->{include_private} || 0;
+ my $min_slice = ref($options) && $options->{min_slice} || 0;
$min_slice = 0 if !$constants->{plugin}{FireHose};
# This seems like a horrendous query, but I _think_ it will run
@@ -1791,8 +1828,8 @@
sub listTagnamesRecent {
my($self, $options) = @_;
my $constants = getCurrentStatic();
- my $seconds = $options->{seconds} || (3600*6);
- my $include_private = $options->{include_private} || 0;
+ my $seconds = ref($options) && $options->{seconds} || (3600*6);
+ my $include_private = ref($options) && $options->{include_private} || 0;
my $private_clause = $include_private ? '' : " AND private='no'";
my $recent_ar = $self->sqlSelectColArrayref(
'DISTINCT tagnames.tagname',
@@ -1820,24 +1857,65 @@
$a2 cmp $b2 || $a1 cmp $b1;
}
+{ # closure
+my $tagname_cache_lastcheck = 1;
sub listTagnamesByPrefix {
my($self, $prefix_str, $options) = @_;
my $constants = getCurrentStatic();
my $reader = getObject('Slash::DB', { db_type => 'reader' });
- my $like_str = $self->sqlQuote("$prefix_str%");
- my $minc = $self->sqlQuote($options->{minc} || $constants->{tags_prefixlist_minc} || 4);
- my $mins = $self->sqlQuote($options->{mins} || $constants->{tags_prefixlist_mins} || 3);
- my $num = $options->{num} || $constants->{tags_prefixlist_num};
- $num = 10 if !$num || $num !~ /^(\d+)$/ || $num < 1;
+ my $ret_hr;
my $mcd = undef;
$mcd = $self->getMCD() unless $options;
my $mcdkey = "$self->{_mcd_keyprefix}:tag_prefx:";
if ($mcd) {
- my $ret_str = $mcd->get("$mcdkey$prefix_str");
- return $ret_str if $ret_str;
+ $ret_hr = $mcd->get("$mcdkey$prefix_str");
+ return $ret_hr if $ret_hr;
}
+ # If the tagname_cache table has been filled, use it.
+ # Otherwise, perform an expensive query directly.
+ # The logic is that $tagname_cache_lastcheck stays a
+ # large positive number (a timestamp) until we determine
+ # that the table _does_ have rows, at which point that
+ # number drops to 0. Once its value hits 0, it is never
+ # checked again.
+ if ($tagname_cache_lastcheck > 0 && $tagname_cache_lastcheck < time()-3600) {
+ my $rows = $reader->sqlCount('tagname_cache');
+ $tagname_cache_lastcheck = $rows ? 0 : time;
+ }
+ my $use_cache_table = $tagname_cache_lastcheck ? 0 : 1;
+ if ($use_cache_table) {
+ $ret_hr = $self->listTagnamesByPrefix_cache($prefix_str, $options);
+ } else {
+ $ret_hr = $self->listTagnamesByPrefix_direct($prefix_str, $options);
+ }
+
+ if ($mcd) {
+ # The expiration we use is much longer than the tags_cache_expire
+ # var since the cache data changes only once a day.
+ $mcd->set("$mcdkey$prefix_str", $ret_hr, 3600);
+ }
+
+ return $ret_hr;
+}
+}
+
+# This is a quick-and-dirty (and not very accurate) estimate which
+# is only performed for a site which has not built its tagname_cache
+# table yet. Hopefully most sites will use this the first day the
+# Tags plugin is installed and then never again.
+
+sub listTagnamesByPrefix_direct {
+ my($self, $prefix_str, $options) = @_;
+ my $constants = getCurrentStatic();
+ my $like_str = $self->sqlQuote("$prefix_str%");
+ my $minc = $self->sqlQuote($options->{minc} || $constants->{tags_prefixlist_minc} || 4);
+ my $mins = $self->sqlQuote($options->{mins} || $constants->{tags_prefixlist_mins} || 3);
+ my $num = $options->{num} || $constants->{tags_prefixlist_num};
+ $num = 10 if !$num || $num !~ /^(\d+)$/ || $num < 1;
+
+ my $reader = getObject('Slash::DB', { db_type => 'reader' });
my $ar = $reader->sqlSelectAllHashrefArray(
'tagname,
COUNT(DISTINCT tags.uid) AS c,
@@ -1856,13 +1934,25 @@
for my $hr (@$ar) {
$ret_hr->{ $hr->{tagname} } = $hr->{sc};
}
- if ($mcd) {
- my $mcdexp = $constants->{tags_cache_expire} || 180;
- $mcd->set("$mcdkey$prefix_str", $ret_hr, $mcdexp)
- }
return $ret_hr;
}
+sub listTagnamesByPrefix_cache {
+ my($self, $prefix_str, $options) = @_;
+ my $constants = getCurrentStatic();
+ my $like_str = $self->sqlQuote("$prefix_str%");
+ my $num = $options->{num} || $constants->{tags_prefixlist_num};
+ $num = 10 if !$num || $num !~ /^(\d+)$/ || $num < 1;
+
+ my $reader = getObject('Slash::DB', { db_type => 'reader' });
+ my $ret_hr = $reader->sqlSelectAllKeyValue(
+ 'tagname, weight',
+ 'tagname_cache',
+ "tagname LIKE $like_str",
+ "ORDER BY weight DESC LIMIT $num");
+ return $ret_hr;
+}
+
sub getPrivateTagnames {
my ($self) = @_;
my $user = getCurrentUser;
Modified: slashjp/branches/upstream/current/plugins/Tags/mysql_dump.sql
===================================================================
--- slashjp/branches/upstream/current/plugins/Tags/mysql_dump.sql 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/plugins/Tags/mysql_dump.sql 2008-04-01 03:35:14 UTC (rev 560)
@@ -1,5 +1,5 @@
#
-# $Id: mysql_dump.sql,v 1.34 2008/02/28 19:51:01 jamiemccarthy Exp $
+# $Id: mysql_dump.sql,v 1.36 2008/03/11 19:57:26 jamiemccarthy Exp $
#
INSERT INTO vars (name, value, description) VALUES ('memcached_exptime_tags', '3600', 'Seconds to cache tag data in memcached');
@@ -10,6 +10,7 @@
INSERT INTO vars (name, value, description) VALUES ('tags_cache_expire', '180', 'Local data cache expiration for tags');
INSERT INTO vars (name, value, description) VALUES ('tags_list_mintc', '4', 'Minimum value of total_clout for tagged items shown at /tags/foo');
INSERT INTO vars (name, value, description) VALUES ('tags_prefixlist_minc', '4', 'Minimum value of c (count) for tagnames returned by listTagnamesByPrefix');
+INSERT INTO vars (name, value, description) VALUES ('tags_prefixlist_minlen', '3', 'Minimum length of a tag prefix to bother looking up suggestions for');
INSERT INTO vars (name, value, description) VALUES ('tags_prefixlist_mins', '3', 'Minimum value of s (clout sum) for tagnames returned by listTagnamesByPrefix');
INSERT INTO vars (name, value, description) VALUES ('tags_prefixlist_num', '10', 'Number of tagnames returned by listTagnamesByPrefix');
INSERT INTO vars (name, value, description) VALUES ('tags_prefixlist_priority', 'back bookmark feed hold journal none quik submission story', 'Tagnames to give priority to on autocomplete');
@@ -48,6 +49,7 @@
INSERT INTO ajax_ops VALUES (NULL, 'tags_admin_commands', 'Slash::Tags', 'ajaxProcessAdminTags', 'ajax_admin', 'use');
INSERT INTO ajax_ops VALUES (NULL, 'tags_history', 'Slash::Tags', 'ajaxTagHistory', 'ajax_admin', 'createuse');
INSERT INTO ajax_ops VALUES (NULL, 'tags_list_tagnames', 'Slash::Tags', 'ajaxListTagnames', 'ajax_tags_read', 'createuse');
+INSERT INTO ajax_ops VALUES (NULL, 'tags_deactivate', 'Slash::Tags', 'ajaxDeactivateTag', 'ajax_tags_write', 'use');
INSERT INTO menus VALUES (NULL, 'tagszg', 'Active', 'active', '[% gSkin.rootdir %]/tags', 1, 1, 1);
INSERT INTO menus VALUES (NULL, 'tagszg', 'Recent', 'recent', '[% gSkin.rootdir %]/tags/recent', 1, 1, 2);
Modified: slashjp/branches/upstream/current/plugins/Tags/mysql_schema.sql
===================================================================
--- slashjp/branches/upstream/current/plugins/Tags/mysql_schema.sql 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/plugins/Tags/mysql_schema.sql 2008-04-01 03:35:14 UTC (rev 560)
@@ -1,5 +1,5 @@
#
-# $Id: mysql_schema.sql,v 1.17 2007/09/26 21:25:51 jamiemccarthy Exp $
+# $Id: mysql_schema.sql,v 1.18 2008/03/19 14:49:36 jamiemccarthy Exp $
#
DROP TABLE IF EXISTS tags;
@@ -33,7 +33,19 @@
PRIMARY KEY tagnameid (tagnameid),
UNIQUE tagname (tagname)
) TYPE=InnoDB;
-
+
+# tagname_cache is not normalized because it's intended to be used
+# for quick lookups.
+
+DROP TABLE IF EXISTS tagname_cache;
+CREATE TABLE tagname_cache (
+ tagnameid int UNSIGNED NOT NULL,
+ tagname VARCHAR(64) NOT NULL,
+ weight FLOAT UNSIGNED DEFAULT 0.0 NOT NULL,
+ PRIMARY KEY tagnameid (tagnameid),
+ UNIQUE tagname (tagname),
+) TYPE=InnoDB;
+
DROP TABLE IF EXISTS tagname_params;
CREATE TABLE tagname_params (
tagnameid int UNSIGNED NOT NULL,
Modified: slashjp/branches/upstream/current/plugins/Tags/tagbox.pl
===================================================================
--- slashjp/branches/upstream/current/plugins/Tags/tagbox.pl 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/plugins/Tags/tagbox.pl 2008-04-01 03:35:14 UTC (rev 560)
@@ -2,7 +2,7 @@
# This code is a part of Slash, and is released under the GPL.
# Copyright 1997-2005 by Open Source Technology Group. See README
# and COPYING for more information, or see http://slashcode.com/.
-# $Id: tagbox.pl,v 1.18 2008/01/30 22:42:38 jamiemccarthy Exp $
+# $Id: tagbox.pl,v 1.19 2008/03/10 20:39:02 jamiemccarthy Exp $
use strict;
@@ -282,7 +282,7 @@
sub insert_feederlog {
my($tagbox, $feeder_ar) = @_;
for my $feeder_hr (@$feeder_ar) {
-main::tagboxLog("addFeederInfo: tbid=$tagbox->{tbid} tagid=$feeder_hr->{tagid} affected_id=$feeder_hr->{affected_id} imp=$feeder_hr->{importance}");
+{ my $fstr = Dumper($feeder_hr); $fstr =~ s/\s+/ /g; main::tagboxLog("addFeederInfo: tbid=$tagbox->{tbid} f: $fstr"); }
$tagboxdb->addFeederInfo($tagbox->{tbid}, $feeder_hr);
}
}
@@ -300,6 +300,10 @@
for my $affected_hr (@$affected_ar) {
my $tagbox = $tagboxdb->getTagboxes($affected_hr->{tbid}, [qw( object )]);
#my $ad = Dumper($affected_hr); $ad =~ s/\s+/ /g; my $tb = Dumper($tagbox); $tb =~ s/\s+/ /g; print STDERR "r_t_u affected_hr: $ad tagbox: $tb\n";
+if ($affected_hr->{tbid} == 17) {
+my $feeder_ar = $tagboxdb->sqlSelectAllHashrefArray('*', 'tagboxlog_feeder', "tbid=17 AND affected_id=$affected_hr->{affected_id}", 'ORDER BY tfid');
+print STDERR "r_t_u rows for tbid=17 id=$affected_hr->{affected_id}: " . Dumper($feeder_ar)
+}
$tagbox->{object}->run($affected_hr->{affected_id});
$tagboxdb->markTagboxRunComplete($affected_hr);
last if time() >= $run_until || $task_exit_flag;
Added: slashjp/branches/upstream/current/plugins/Tags/tags_tagnamecache.pl
===================================================================
--- slashjp/branches/upstream/current/plugins/Tags/tags_tagnamecache.pl (rev 0)
+++ slashjp/branches/upstream/current/plugins/Tags/tags_tagnamecache.pl 2008-04-01 03:35:14 UTC (rev 560)
@@ -0,0 +1,144 @@
+#!/usr/bin/perl -w
+# This code is a part of Slash, and is released under the GPL.
+# Copyright 1997-2005 by Open Source Technology Group. See README
+# and COPYING for more information, or see http://slashcode.com/.
+# $Id: tags_tagnamecache.pl,v 1.1 2008/03/21 04:10:35 jamiemccarthy Exp $
+
+# Once a day, rewrite the tags_tagnamecache table, used for finding
+# tagname suggestions based on prefixes.
+
+use strict;
+use vars qw( %task $me $task_exit_flag );
+use Slash::DB;
+use Slash::Display;
+use Slash::Utility;
+use Slash::Constants ':slashd';
+
+(my $VERSION) = ' $Revision: 1.1 $ ' =~ /\$Revision:\s+([^\s]+)/;
+
+$task{$me}{timespec} = "30 6 * * *";
+$task{$me}{timespec_panic_1} = ''; # not that important
+$task{$me}{fork} = SLASHD_NOWAIT;
+
+$task{$me}{code} = sub {
+ my($virtual_user, $constants, $slashdb, $user) = @_;
+ my $tagsdb = getObject('Slash::Tags');
+ my $tagsdb_reader = getObject('Slash::Tags', { db_type => 'reader' });
+ my $daysback = $constants->{tags_tagnamecache_daysback} || 180;
+ my $min_tagid = getMinimumTagid($tagsdb, $daysback);
+ my $ar = getTagnameList($tagsdb_reader, $min_tagid);
+ my $rows_replaced = replaceTagnames($tagsdb, $ar);
+ my $rows_deleted = deleteTagnamesNotIn($tagsdb, $ar);
+ my $total_rows = $tagsdb->sqlCount('tagname_cache');
+ return "replaced $rows_replaced, deleted $rows_deleted, total $total_rows";
+};
+
+sub getMinimumTagid {
+ my($tagsdb, $daysback) = @_;
+ my $min = $tagsdb->sqlSelectNumericKeyAssumingMonotonic(
+ 'tags', 'min', 'tagid',
+ "created_at >= DATE_SUB(NOW(), INTERVAL $daysback DAY)");
+ return $min;
+}
+
+# For now, let's include private tagnames in this list. It's not
+# revealing private information since it's completely aggregated,
+# and while suggesting tagnames like 'nod' and 'nix' may not be
+# helpful, suggesting 'troll' and 'interesting' seems OK.
+
+sub getTagnameList {
+ my($tagsdb_reader, $min_tagid) = @_;
+ $min_tagid ||= 1;
+
+ my $constants = getCurrentStatic();
+ my $minc = $tagsdb_reader->sqlQuote($constants->{tags_prefixlist_minc} || 4);
+ my $mins = $tagsdb_reader->sqlQuote($constants->{tags_prefixlist_mins} || 3);
+ # $maxnum is to prevent $tagnameid_str from exceeding MySQL limits.
+ # Default max_allowed_packet should be 16 MB, so an ~80K query
+ # should be perfectly fine.
+ my $maxnum = 10000;
+
+ # Get the list of tagnameids sorted in a very rough order of
+ # "importance."
+ # Note that the query uses multiple columns to sort the data,
+ # but we skim off only the tagnameid on the client side since
+ # that's all we care about.
+
+ my $tagnameid_ar = $tagsdb_reader->sqlSelectColArrayref(
+ 'tags.tagnameid,
+ COUNT(DISTINCT tags.uid) AS c,
+ SUM(tag_clout * IF(value IS NULL, 1, value)) AS s,
+ COUNT(DISTINCT tags.uid)/3 + SUM(tag_clout * IF(value IS NULL, 1, value)) AS sc',
+ 'tags, users_info, tagnames
+ LEFT JOIN tagname_params USING (tagnameid)',
+ "tagnames.tagnameid=tags.tagnameid
+ AND tags.uid=users_info.uid
+ AND tags.inactivated IS NULL
+ AND tagid >= $min_tagid",
+ "GROUP BY tags.tagnameid
+ HAVING c >= $minc AND s >= $mins
+ ORDER BY sc DESC, tagname ASC
+ LIMIT $maxnum");
+ return [ ] if !$tagnameid_ar || !@$tagnameid_ar;
+ my $tagnameid_str = join(',', sort { $a <=> $b } @$tagnameid_ar);
+
+ # Now get the total list of tags (which will be very large,
+ # so this is a slow query)
+
+ my $tag_ar = $tagsdb_reader->sqlSelectAllHashrefArray(
+ '*, UNIX_TIMESTAMP(created_at) AS created_at_ut',
+ 'tags',
+ "tagnameid IN ($tagnameid_str)
+ AND tagid >= $min_tagid
+ AND tags.inactivated IS NULL");
+
+ # This will call getUser() for every uid in the above list and
+ # getTagnameidClid() for every tagnameid (up to 10,000). So
+ # this will be a very slow operation.
+
+ $tagsdb_reader->addCloutsToTagArrayref($tag_ar);
+
+ my $tagnameid_sum = { };
+ for my $hr (@$tag_ar) {
+ $tagnameid_sum->{ $hr->{tagnameid} } ||= 0;
+ $tagnameid_sum->{ $hr->{tagnameid} } += $hr->{total_clout};
+ }
+ my $ret_ar = [ ];
+ for my $tagnameid (@$tagnameid_ar) {
+ my $sum = $tagnameid_sum->{$tagnameid};
+ next unless $sum > 0;
+ my $tagname = $tagsdb_reader->getTagnameDataFromId($tagnameid)->{tagname};
+ push @$ret_ar, {
+ tagnameid => $tagnameid,
+ tagname => $tagname,
+ weight => $sum,
+ };
+ }
+
+ return $ret_ar;
+}
+
+sub replaceTagnames {
+ my($tagsdb, $ar) = @_;
+ my $rows = 0;
+ for my $hr (@$ar) {
+ $rows += $tagsdb->sqlReplace('tagname_cache', $hr);
+ Time::HiRes::sleep(0.01);
+ }
+ return $rows;
+}
+
+sub deleteTagnamesNotIn {
+ my($tagsdb, $ar) = @_;
+ my $tagnameid_str = join(',',
+ sort { $a <=> $b }
+ map { $_->{tagnameid} }
+ @$ar
+ );
+ my $rows = $tagsdb->sqlDelete('tagname_cache',
+ "tagnameid NOT IN ($tagnameid_str)");
+ return $rows;
+}
+
+1;
+
Modified: slashjp/branches/upstream/current/plugins/Tags/templates/tagsstorydivtagbox;misc;default
===================================================================
--- slashjp/branches/upstream/current/plugins/Tags/templates/tagsstorydivtagbox;misc;default 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/plugins/Tags/templates/tagsstorydivtagbox;misc;default 2008-04-01 03:35:14 UTC (rev 560)
@@ -13,7 +13,7 @@
__name__
tagsstorydivtagbox
__template__
-[% sidenc = story.sid.replace("/",":") %]
+[% sidenc = story.sid.replace("/","-") # no '/'s in html ids (see: http://www.w3.org/TR/html401/types.html) %]
[% IF user.tags_canread_stories %]
@@ -54,4 +54,4 @@
__seclev__
10000
__version__
-$Id: tagsstorydivtagbox;misc;default,v 1.10 2007/10/24 00:30:08 scc Exp $
+$Id: tagsstorydivtagbox;misc;default,v 1.11 2008/03/13 17:15:30 scc Exp $
Modified: slashjp/branches/upstream/current/sql/mysql/defaults.sql
===================================================================
--- slashjp/branches/upstream/current/sql/mysql/defaults.sql 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/sql/mysql/defaults.sql 2008-04-01 03:35:14 UTC (rev 560)
@@ -3,7 +3,7 @@
#--------------------------------------------------------
# Server version 3.23.26-beta-log
#
-# $Id: defaults.sql,v 1.393 2008/02/28 20:44:48 pudge Exp $
+# $Id: defaults.sql,v 1.394 2008/03/12 16:48:57 pudge Exp $
#
#
@@ -832,7 +832,7 @@
INSERT INTO vars (name, value, description) VALUES ('cur_performance_stats_lastid', '0', 'accesslogid to start searching at');
INSERT INTO vars (name, value, description) VALUES ('cur_performance_stats_weeks', '8', 'number of weeks back to compare current stats to');
INSERT INTO vars (name, value, description) VALUES ('currentqid',1,'The Current Question on the homepage pollbooth');
-INSERT INTO vars (name, value, description) VALUES ('cvs_tag_currentcode','T_2_5_0_196','The current cvs tag that the code was updated to - this does not affect site behavior but may be useful for your records');
+INSERT INTO vars (name, value, description) VALUES ('cvs_tag_currentcode','T_2_5_0_197','The current cvs tag that the code was updated to - this does not affect site behavior but may be useful for your records');
INSERT INTO vars (name, value, description) VALUES ('datadir','/usr/local/slash/www.example.com','What is the root of the install for Slash');
INSERT INTO vars (name, value, description) VALUES ('db_auto_increment_increment','1','If your master DB uses auto_increment_increment, i.e. multiple master replication, echo its value into this var');
INSERT INTO vars (name, value, description) VALUES ('dbsparklines_disp','0','Display dbsparklines in the currentAdminUsers box?');
Modified: slashjp/branches/upstream/current/sql/mysql/upgrades
===================================================================
--- slashjp/branches/upstream/current/sql/mysql/upgrades 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/sql/mysql/upgrades 2008-04-01 03:35:14 UTC (rev 560)
@@ -10,7 +10,7 @@
# after X started at the same time that X was tagged.
#
-# $Id: upgrades,v 1.1318 2008/02/28 20:44:48 pudge Exp $
+# $Id: upgrades,v 1.1328 2008/03/21 02:44:47 pudge Exp $
#
# BEGIN tf23's additions
@@ -5049,8 +5049,6 @@
# not for slashdot
UPDATE vars SET value = 'yes no binspam dupe notthebest offtopic stupid slownewsday interesting funny insightful' WHERE name = 'tagbox_top_excludetagnames';
-# PUDGE LAST UPDATED HERE
-
# 2007-12-05
UPDATE vars SET value = 'T_2_5_0_185' WHERE name = 'cvs_tag_currentcode';
@@ -5136,8 +5134,6 @@
# 2008-02-13
UPDATE vars SET value = 'T_2_5_0_194' WHERE name = 'cvs_tag_currentcode';
-# SLASHDOT LAST UPDATED HERE
-
# For sites *without* plugins/Tags
DELETE FROM clout_types;
@@ -5147,8 +5143,6 @@
# 2008-02-20
UPDATE vars SET value = 'T_2_5_0_195' WHERE name = 'cvs_tag_currentcode';
-# SLASHCODE/USEPERL LAST UPDATED HERE
-
# for plugins/Tags
INSERT INTO vars (name, value, description) VALUES ('tags_unknowntype_default_clid', '1', 'For tags of unknown type, which clout id do we pretend they are?');
INSERT INTO vars (name, value, description) VALUES ('tags_unknowntype_default_mult', '0.3', 'For tags of unknown type, what multiplier do we give to the tagging user clout or type tags_unknowntype_default_clid?');
@@ -5156,3 +5150,50 @@
# 2008-02-28
UPDATE vars SET value = 'T_2_5_0_196' WHERE name = 'cvs_tag_currentcode';
+# for plugins/Tags
+INSERT INTO ajax_ops VALUES (NULL, 'tags_deactivate', 'Slash::Tags', 'ajaxDeactivateTag', 'ajax_tags_write', 'use');
+INSERT INTO vars (name, value, description) VALUES ('tags_prefixlist_minlen', '3', 'Minimum length of a tag prefix to bother looking up suggestions for');
+
+# 2008-03-12
+UPDATE vars SET value = 'T_2_5_0_197' WHERE name = 'cvs_tag_currentcode';
+
+# SLASHDOT LAST UPDATED HERE
+
+# for plugins/Ajax
+UPDATE ajax_ops set reskey_name = 'ajax_user_static', reskey_type='createuse' WHERE op='admin_signoff';
+
+# comments
+DELETE FROM reskey_resource_checks WHERE rkrid = 1;
+INSERT INTO reskey_resource_checks VALUES (NULL, 1, 'all', 'Slash::ResKey::Checks::User', 101);
+INSERT INTO reskey_resource_checks VALUES (NULL, 1, 'all', 'Slash::ResKey::Checks::ACL', 201);
+INSERT INTO reskey_resource_checks VALUES (NULL, 1, 'all', 'Slash::ResKey::Checks::AL2::AnonNoPost', 301);
+INSERT INTO reskey_resource_checks VALUES (NULL, 1, 'all', 'Slash::ResKey::Checks::AL2::NoPostAnon', 401);
+INSERT INTO reskey_resource_checks VALUES (NULL, 1, 'all', 'Slash::ResKey::Checks::AL2::NoPost', 501);
+INSERT INTO reskey_resource_checks VALUES (NULL, 1, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531);
+INSERT INTO reskey_resource_checks VALUES (NULL, 1, 'all', 'Slash::ResKey::Checks::Duration', 601);
+
+DELETE FROM reskey_vars WHERE rkrid = 1;
+INSERT INTO reskey_vars VALUES (1, 'adminbypass', 1, 'If admin, bypass checks for duration, proxy, and user');
+INSERT INTO reskey_vars VALUES (1, 'acl_no', 'reskey_no_comments', 'If this ACL present, can\'t use resource');
+INSERT INTO reskey_vars VALUES (1, 'user_seclev', 0, 'Minimum seclev to use resource');
+INSERT INTO reskey_vars VALUES (1, 'duration_max-uses', 30, 'how many uses per timeframe');
+INSERT INTO reskey_vars VALUES (1, 'duration_max-failures', 10, 'how many failures per reskey');
+INSERT INTO reskey_vars VALUES (1, 'duration_uses', 60, 'min duration (in seconds) between uses');
+INSERT INTO reskey_vars VALUES (1, 'duration_creation-use', 10, 'min duration between (in seconds) creation and use');
+
+# for plugins/Tags
+CREATE TABLE tagname_cache (
+ tagnameid int UNSIGNED NOT NULL,
+ tagname VARCHAR(64) NOT NULL,
+ weight FLOAT UNSIGNED DEFAULT 0.0 NOT NULL,
+ PRIMARY KEY tagnameid (tagnameid),
+ UNIQUE tagname (tagname)
+) TYPE=InnoDB;
+
+
+# 2008-03-19
+UPDATE vars SET value = 'T_2_5_0_198' WHERE name = 'cvs_tag_currentcode';
+
+# SLASHCODE/USEPERL LAST UPDATED HERE
+
+# PUDGE LAST UPDATED HERE
Modified: slashjp/branches/upstream/current/tagboxes/Despam/Despam.pm
===================================================================
--- slashjp/branches/upstream/current/tagboxes/Despam/Despam.pm 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/tagboxes/Despam/Despam.pm 2008-04-01 03:35:14 UTC (rev 560)
@@ -2,7 +2,7 @@
# This code is a part of Slash, and is released under the GPL.
# Copyright 1997-2005 by Open Source Technology Group. See README
# and COPYING for more information, or see http://slashcode.com/.
-# $Id: Despam.pm,v 1.7 2008/01/24 18:27:41 jamiemccarthy Exp $
+# $Id: Despam.pm,v 1.9 2008/03/12 14:27:28 jamiemccarthy Exp $
package Slash::Tagbox::Despam;
@@ -28,7 +28,7 @@
use Data::Dumper;
use vars qw( $VERSION );
-$VERSION = ' $Revision: 1.7 $ ' =~ /\$Revision:\s+([^\s]+)/;
+$VERSION = ' $Revision: 1.9 $ ' =~ /\$Revision:\s+([^\s]+)/;
use base 'Slash::DB::Utility'; # first for object init stuff, but really
# needs to be second! figure it out. -- pudge
@@ -53,9 +53,10 @@
my $constants = getCurrentStatic();
my $tagsdb = getObject('Slash::Tags');
- $self->{spamid} = $tagsdb->getTagnameidCreate('binspam');
- $self->{upvoteid} = $tagsdb->getTagnameidCreate($constants->{tags_upvote_tagname} || 'nod');
+ $self->{spamid} = $tagsdb->getTagnameidCreate('binspam');
return undef unless $self->{spamid};
+ $self->{upvoteid} = $tagsdb->getTagnameidCreate($constants->{tags_upvote_tagname} || 'nod');
+ $self->{recalc_tbids} = undef;
return $self;
}
@@ -91,6 +92,7 @@
};
push @$ret_ar, $ret_hr;
}
+ main::tagboxLog("Despam->feed_newtags A " . scalar(@$ret_ar) . ": '@$ret_ar'");
return [ ] if !@$ret_ar;
# Tags applied to globjs that have a firehose entry associated
@@ -101,6 +103,7 @@
'globjid',
'firehose',
"globjid IN ($globjs_str)");
+ main::tagboxLog("Despam->feed_newtags B " . scalar(@$fh_globjs_ar) . ": '@$fh_globjs_ar'");
return [ ] if !@$fh_globjs_ar; # if no affected globjs have firehose entries, short-circuit out
my %fh_globjs = ( map { $_, 1 } @$fh_globjs_ar );
$ret_ar = [ grep { $fh_globjs{ $_->{affected_id} } } @$ret_ar ];
@@ -111,13 +114,10 @@
sub feed_deactivatedtags {
my($self, $tags_ar) = @_;
- # XXX This need not do anything, I don't think -- not even call
- # feed_newtags.
- # The way Despam is set up, 2 admin binspam tags will mark a globjid,
- # and even if 1 of them is deactivated a moment later, we have no way
- # to undo the process.
- main::tagboxLog("Despam->feed_deactivatedtags called: tags_ar='" . join(' ', map { $_->{tagid} } @$tags_ar) . "', returning nothing");
- return [ ];
+ main::tagboxLog("Despam->feed_deactivatedtags called: tags_ar='" . join(' ', map { $_->{tagid} } @$tags_ar) . "', calling feed_newtags");
+ my $ret_ar = $self->feed_newtags($tags_ar);
+ main::tagboxLog("Despam->feed_deactivatedtags returning " . scalar(@$ret_ar));
+ return $ret_ar;
}
sub feed_userchanges {
@@ -134,6 +134,7 @@
my $firehose_db = getObject('Slash::FireHose');
my $slashdb = getCurrentDB();
+ # Get the list of admin uids.
my $admins = $tagsdb->getAdmins();
my $admin_in_str = join(',',
sort { $a <=> $b }
@@ -141,170 +142,281 @@
keys %$admins);
return unless $admin_in_str;
+ # Get info about the firehose item that may have been tagged.
my $affected_id_q = $self->sqlQuote($affected_id);
- my $fhid = $self->sqlSelect('id', 'firehose', "globjid = $affected_id_q");
- warn "Slash::Tagbox::Despam->run bad data, fhid='$fhid' db='$firehose_db'" if !$fhid || !$firehose_db;
+ my $fhid = $self->sqlSelect('DISTINCT id', 'firehose', "globjid = $affected_id_q");
+ if (!$fhid || !$firehose_db) {
+ main::tagboxLog("Slash::Tagbox::Despam->run bad data, fhid='$fhid' db='$firehose_db'");
+ return ;
+ }
my $fhitem = $firehose_db->getFireHose($fhid);
+
+ # Get info about the uid and ipid that submitted the firehose item.
+ # We only track ipid for actual submissions, not journals/bookmarks.
my $submitter_uid = $fhitem->{uid};
- my $submitter_srcid = $fhitem->{srcid_32};
+ my $submitter_ipid = '';
+ my $types = $slashdb->getGlobjTypes();
+ my $submission_gtid = $types->{submissions};
+ if ($submission_gtid) {
+ $submitter_ipid = $slashdb->sqlSelect(
+ 'ipid',
+ 'globjs, submissions',
+ "globjid=$affected_id
+ AND gtid=$submission_gtid
+ AND target_id=subid"
+ ) || '';
+ }
- my $binspam_count = $slashdb->sqlCount(
- 'tags, firehose',
- "tags.uid IN ($admin_in_str)
- AND tags.inactivated IS NULL
- AND tags.tagnameid = $self->{spamid}
- AND tags.globjid = firehose.globjid
- AND firehose.uid = $submitter_uid");
- my $binspam_tagids = $slashdb->sqlSelectColArrayref(
- 'tagid',
- 'tags, firehose',
- "tags.uid IN ($admin_in_str)
- AND tags.inactivated IS NULL
- AND tags.tagnameid = $self->{spamid}
- AND tags.globjid = firehose.globjid
- AND firehose.uid = $submitter_uid");
- main::tagboxLog(sprintf("%s->run marking fhid %d (%d) as is_spam (for count %d on uid %d: '%s')",
- ref($self), $fhid, $affected_id, $binspam_count, $submitter_uid, join(' ', @$binspam_tagids)));
- $firehose_db->setFireHose($fhid, { is_spam => 'yes' });
+ # First figure out how many times the globjid was tagged binspam by
+ # an admin. It may be zero (if forceFeederRecalc was called, or if
+ # an old binspam tag was deactivated). Even one admin binspam tag
+ # is enough to mark the individual item as binspam.
+ my $binspam_count_globjid = $slashdb->sqlCount(
+ 'tags',
+ "globjid=$affected_id
+ AND tagnameid=$self->{spamid}
+ AND uid IN ($admin_in_str)
+ AND inactivated IS NULL");
+ my $is_spam = $binspam_count_globjid > 0 ? 1 : 0;
- if (isAnon($submitter_uid)) {
- # Non-logged-in user, check by IP (srcid_32)
- if ($submitter_srcid &&
- $binspam_count > $constants->{tagbox_despam_binspamsallowed_ip}
- ) {
- main::tagboxLog(sprintf("%s->run marking srcid %s for %d admin binspam tags, based on %d (%d)",
- ref($self), $submitter_srcid, $binspam_count, $fhid, $affected_id));
- $self->despam_srcid($submitter_srcid, $binspam_count);
- }
- } else {
- # Logged-in user, check by uid
- if ($binspam_count > $constants->{tagbox_despam_binspamsallowed}) {
- main::tagboxLog(sprintf("%s->run marking uid %d for %d admin binspam tags, based on %d (%d)",
- ref($self), $submitter_uid, $binspam_count, $fhid, $affected_id));
- $self->despam_uid($submitter_uid, $binspam_count);
- }
+ # Now see how many times this globjid's uid (or, if anonymous, ipid)
+ # was tagged binspam by an admin. If greater than a certain
+ # threshold, that srcid (uid/ipid) will be given the 'spammer' al2.
+ my($check_type, $srcid, $table_clause, $where_clause) = (undef, undef);
+ if (!isAnon($submitter_uid)) {
+ # Logged-in user, check by uid.
+ $check_type = 'uid';
+ $srcid = $submitter_uid;
+ $table_clause = '';
+ $where_clause = "firehose.uid = $submitter_uid";
+ } elsif ($submitter_ipid) {
+ # Non-logged-in user, check by IP (submissions.ipid)
+ $check_type = 'ipid';
+ $srcid = convert_srcid('ipid', $submitter_ipid);
+ $table_clause = ', globjs, submissions';
+ $where_clause = "firehose.type='submission'
+ AND firehose.globjid=globjs.globjid
+ AND globjs.target_id=submissions.subid
+ AND submissions.ipid='$submitter_ipid'";
}
-}
+ # If neither of the above, it's an anonymous non-submission, so
+ # (at present) there's nothing we will do to block its "fellow"
+ # firehose items.
-sub despam_srcid {
- my($self, $srcid, $count) = @_;
- my $slashdb = getCurrentDB();
- my $constants = getCurrentStatic();
+ # Find out which and how many other 'binspam' tags this contributor
+ # has amassed in total (where "contributor" can be an ipid or uid).
+ my $binspam_tagid_globj_hr = { };
+ if ($check_type) {
+ $binspam_tagid_globj_hr = $slashdb->sqlSelectAllKeyValue(
+ 'tags.tagid, tags.globjid',
+ "tags, firehose$table_clause",
+ "tags.globjid = firehose.globjid
+ AND tags.tagnameid = $self->{spamid}
+ AND tags.uid IN ($admin_in_str)
+ AND tags.inactivated IS NULL
+ AND $where_clause");
+ }
- my $al2_hr = $slashdb->getAL2($srcid);
- if ($count > $constants->{tagbox_despam_binspamsallowed_ip}) {
- main::tagboxLog("marking $srcid as spammer for $count");
- if (!$al2_hr->{spammer}) {
- $slashdb->setAL2($srcid, { spammer => 1, comment => "Despam $count" });
- }
+ # This array contains the list of admin tags applied to
+ # firehose items from this srcid. If there are too many
+ # of them, mark the srcid.
+ my $binspam_count = scalar(keys %$binspam_tagid_globj_hr);
+ my $mark_srcid = 0;
+ if ($binspam_count >
+ ( $check_type eq 'uid'
+ ? $constants->{tagbox_despam_binspamsallowed}
+ : $constants->{tagbox_despam_binspamsallowed_ip} )
+ ) {
+ $is_spam = $mark_srcid = 1;
}
-}
-sub despam_uid {
- my($self, $uid, $count) = @_;
- my $constants = getCurrentStatic();
- my $slashdb = getCurrentDB();
- my $reader = getObject('Slash::DB', { db_type => 'reader' });
- my $tagboxdb = getObject('Slash::Tagbox');
+ main::tagboxLog(sprintf("%s->run uid=%d ipid=%s check_type=%s affected_id=%d srcid=%s count=%d is_spam=%d mark_srcid=%d tagids: '%s'",
+ ref($self), ($submitter_uid || '0'), ($submitter_ipid || 'none'),
+ (defined($check_type) ? $check_type : 'undef'),
+ $affected_id, $srcid, $binspam_count, $is_spam, $mark_srcid,
+ join(' ', sort { $a <=> $b } keys %$binspam_tagid_globj_hr)));
- # First, set the user's 'spammer' AL2.
- my $adminuid = $constants->{tagbox_despam_al2adminuid};
- my $al2_hr = $slashdb->getAL2($uid);
- if (!$al2_hr->{spammer}) {
- $slashdb->setAL2($uid, { spammer => 1, comment => "Despam $count" },
- { adminuid => $adminuid });
+ # is_spam=0 is_spam=1 mark_srcid=1
+ #
+ # check_type undef clear 1 globj set 1 globjid set 1 globjid
+ # check_type=uid clear 1 globj set 1 globjid set all globjids, setAL2
+ # check_type=ipid clear 1 globj set 1 globjid set all globjids, setAL2
+
+ # Always set/clear at least the one globjid affected.
+ my %globjids = ( $affected_id, 1 );
+ if ($mark_srcid && $check_type) {
+ # Set/clear both the individual globjid and all its
+ # fellow submitted globjids, if known.
+ for my $tagid (keys %$binspam_tagid_globj_hr) {
+ $globjids{ $binspam_tagid_globj_hr->{$tagid} } = 1;
+ }
}
+ # Convert that list of globjids to firehose ids.
+ my $globjid_in_str = join(',', sort { $a <=> $b } keys %globjids);
+ my $fhid_hr = $slashdb->sqlSelectAllKeyValue(
+ 'id, globjid',
+ 'firehose',
+ "globjid IN ($globjid_in_str)");
+ main::tagboxLog(sprintf("%s->run globjids '%s' -> fhids '%s'",
+ ref($self),
+ join(' ', sort { $a <=> $b } keys %globjids),
+ join(' ', sort { $a <=> $b } keys %$fhid_hr)));
- # Next, set the user's clout manually to 0.
- $slashdb->setUser($uid, { tag_clout => 0 });
-
- # Next, mark as spam everything the user's submitted.
- $slashdb->sqlUpdate('firehose', { is_spam => 'yes' },
- "accepted != 'no' AND uid=$uid");
-
- # Next, if $count is high enough, set the 'spammer' AL2 for all
- # the IPID's the user has submitted from.
- if ($count > $constants->{tagbox_despam_binspamsallowed_ip}) {
- my $days = defined($constants->{tagbox_despam_ipdayslookback})
- ? $constants->{tagbox_despam_ipdayslookback} : 60;
- my %srcid_used = ( );
- if ($days) {
- my $sub_ipid_ar = $reader->sqlSelectColArrayref(
- 'DISTINCT ipid',
- 'submissions',
- "uid=$uid AND time >= DATE_SUB(NOW(), INTERVAL $days DAY) AND ipid != ''");
- my $journal_srcid_ar = $reader->sqlSelectColArrayref(
- 'DISTINCT ' . get_srcid_sql_out('srcid_32'),
- 'journals',
- "uid=$uid AND date >= DATE_SUB(NOW(), INTERVAL $days DAY) AND srcid_32 != 0");
- my $book_srcid_ar = $reader->sqlSelectColArrayref(
- 'DISTINCT ' . get_srcid_sql_out('srcid_32'),
- 'bookmarks',
- "uid=$uid AND createdtime >= DATE_SUB(NOW(), INTERVAL $days DAY) AND srcid_32 != 0");
- for my $ipid (@$sub_ipid_ar) {
- my $srcid = convert_srcid(ipid => $ipid);
- $srcid_used{$srcid} = 1;
+ # Loop on all the fhids required to be changed, setting or
+ # clearing them as appropriate.
+ for my $fhid (sort { $a <=> $b } keys %$fhid_hr) {
+ my $globjid = $fhid_hr->{$fhid};
+ my $rows = $firehose_db->setFireHose($fhid, { is_spam => ($is_spam ? 'yes' : 'no') });
+ main::tagboxLog(sprintf("%s->run marked fhid %d (%d) as is_spam=%d rows=%s",
+ ref($self), $fhid, $globjid, $is_spam, $rows));
+ if ($rows > 0) {
+ # If this firehose item's spam status changed, either way, its
+ # scores now need to be recalculated immediately.
+ # Get the list of tbids we need to force a recalc for.
+ if (!defined $self->{recalc_tbids}) {
+ my $tagboxes = $tagboxdb->getTagboxes();
+ for my $tagbox_hr (@$tagboxes) {
+ push @{$self->{recalc_tbids}}, $tagbox_hr->{tbid}
+ if $tagbox_hr->{name} =~ /^(FHEditorPop|FireHoseScores)$/;
+ }
}
- for my $srcid (@$journal_srcid_ar) {
- $srcid_used{$srcid} = 1;
+ # Force the recalculations of their scores.
+ for my $tbid (@{$self->{recalc_tbids}}) {
+ $tagboxdb->forceFeederRecalc($tbid, $globjid);
+ main::tagboxLog(sprintf("%s->run force recalc tbid=%d globjid=%d",
+ ref($self), $tbid, $globjid));
}
- for my $srcid (@$book_srcid_ar) {
- $srcid_used{$srcid} = 1;
- }
- my @srcids = sort grep { $_ } keys %srcid_used;
- for my $srcid (@srcids) {
- $al2_hr = $slashdb->getAL2($srcid);
- if (!$al2_hr->{spammer}) {
- $slashdb->setAL2($srcid, { spammer => 1, comment => "Despam $count for $uid" });
- }
- }
}
}
- # Next, declout everyone who's upvoted any of the user's
- # recent submissions (except bookmarks, because those are
- # generic enough).
- my $daysback = $constants->{tagbox_despam_decloutdaysback} || 7;
- my $upvoter_ar = $slashdb->sqlSelectColArrayref(
- 'DISTINCT tags.uid',
- 'tags, firehose',
- "tags.globjid = firehose.globjid
- AND firehose.uid = $uid
- AND type IN ('submission', 'journal')
- AND createtime >= DATE_SUB(NOW(), INTERVAL $daysback DAY)
- AND tagnameid = $self->{upvoteid}
- AND inactivated IS NULL");
- my $max_clout = defined($constants->{tagbox_despam_upvotermaxclout})
- ? $constants->{tagbox_despam_upvotermaxclout} : '0.85';
- for my $upvoter (@$upvoter_ar) {
- main::tagboxLog("setting user $upvoter clout to max $max_clout for upvoting user $uid");
- $slashdb->setUser($upvoter, {
- -tag_clout => "MAX(tag_clout, $max_clout)"
- });
+ # If appropriate, mark the submitter's uid or ipid as a spammer
+ # and mark _all_ their submissions as binspam.
+ if ($mark_srcid && $check_type) {
+ main::tagboxLog(sprintf("%s->run marking spammer AL2 srcid=%s",
+ ref($self), $srcid));
+ $slashdb->setAL2($srcid, { spammer => 1 }, { adminuid => 1183959 });
}
-
- # Next, insert tagboxlog_feeder entries to tell the relevant
- # tagboxes to recalculate those scores.
- my $tagboxes = $tagboxdb->getTagboxes();
- my @tagboxids = map { $_->{tbid} } grep { $_->{name} =~ /^(FHEditorPop|FireHoseScores)$/ } @$tagboxes;
- my $globjid_tagid = $slashdb->sqlSelectAllKeyValue(
- 'firehose.globjid, tagid',
- 'firehose, tags',
- "firehose.uid=$uid
- AND firehose.globjid=tags.globjid
- AND tags.uid=$uid
- AND tagnameid=$self->{upvoteid}",
- 'GROUP BY firehose.globjid');
- for my $globjid (sort keys %$globjid_tagid) {
- for my $tbid (@tagboxids) {
- $tagboxdb->addFeederInfo($tbid, {
- affected_id => $globjid,
- importance => 1,
- tagid => $globjid_tagid->{ $globjid },
- });
- }
- }
}
+#sub despam_srcid {
+# my($self, $srcid, $count) = @_;
+# my $slashdb = getCurrentDB();
+# my $constants = getCurrentStatic();
+#
+# my $al2_hr = $slashdb->getAL2($srcid);
+# if ($count > $constants->{tagbox_despam_binspamsallowed_ip}) {
+# main::tagboxLog("marking $srcid as spammer for $count");
+# if (!$al2_hr->{spammer}) {
+# $slashdb->setAL2($srcid, { spammer => 1, comment => "Despam $count" });
+# }
+# }
+#}
+#
+#sub despam_uid {
+# my($self, $uid, $count) = @_;
+# my $constants = getCurrentStatic();
+# my $slashdb = getCurrentDB();
+# my $reader = getObject('Slash::DB', { db_type => 'reader' });
+# my $tagboxdb = getObject('Slash::Tagbox');
+#
+# # First, set the user's 'spammer' AL2.
+# my $adminuid = $constants->{tagbox_despam_al2adminuid};
+# my $al2_hr = $slashdb->getAL2($uid);
+# if (!$al2_hr->{spammer}) {
+# $slashdb->setAL2($uid, { spammer => 1, comment => "Despam $count" },
+# { adminuid => $adminuid });
+# }
+#
+# # Next, set the user's clout manually to 0.
+# $slashdb->setUser($uid, { tag_clout => 0 });
+#
+# # Next, mark as spam everything the user's submitted.
+# $slashdb->sqlUpdate('firehose', { is_spam => 'yes' },
+# "accepted != 'no' AND uid=$uid");
+#
+# # Next, if $count is high enough, set the 'spammer' AL2 for all
+# # the IPID's the user has submitted from.
+# if ($count > $constants->{tagbox_despam_binspamsallowed_ip}) {
+# my $days = defined($constants->{tagbox_despam_ipdayslookback})
+# ? $constants->{tagbox_despam_ipdayslookback} : 60;
+# my %srcid_used = ( );
+# if ($days) {
+# my $sub_ipid_ar = $reader->sqlSelectColArrayref(
+# 'DISTINCT ipid',
+# 'submissions',
+# "uid=$uid AND time >= DATE_SUB(NOW(), INTERVAL $days DAY) AND ipid != ''");
+# my $journal_srcid_ar = $reader->sqlSelectColArrayref(
+# 'DISTINCT ' . get_srcid_sql_out('srcid_32'),
+# 'journals',
+# "uid=$uid AND date >= DATE_SUB(NOW(), INTERVAL $days DAY) AND srcid_32 != 0");
+# my $book_srcid_ar = $reader->sqlSelectColArrayref(
+# 'DISTINCT ' . get_srcid_sql_out('srcid_32'),
+# 'bookmarks',
+# "uid=$uid AND createdtime >= DATE_SUB(NOW(), INTERVAL $days DAY) AND srcid_32 != 0");
+# for my $ipid (@$sub_ipid_ar) {
+# my $srcid = convert_srcid(ipid => $ipid);
+# $srcid_used{$srcid} = 1;
+# }
+# for my $srcid (@$journal_srcid_ar) {
+# $srcid_used{$srcid} = 1;
+# }
+# for my $srcid (@$book_srcid_ar) {
+# $srcid_used{$srcid} = 1;
+# }
+# my @srcids = sort grep { $_ } keys %srcid_used;
+# for my $srcid (@srcids) {
+# $al2_hr = $slashdb->getAL2($srcid);
+# if (!$al2_hr->{spammer}) {
+# $slashdb->setAL2($srcid, { spammer => 1, comment => "Despam $count for $uid" });
+# }
+# }
+# }
+# }
+#
+# # Next, declout everyone who's upvoted any of the user's
+# # recent submissions (except bookmarks, because those are
+# # generic enough).
+# my $daysback = $constants->{tagbox_despam_decloutdaysback} || 7;
+# my $upvoter_ar = $slashdb->sqlSelectColArrayref(
+# 'DISTINCT tags.uid',
+# 'tags, firehose',
+# "tags.globjid = firehose.globjid
+# AND firehose.uid = $uid
+# AND type IN ('submission', 'journal')
+# AND createtime >= DATE_SUB(NOW(), INTERVAL $daysback DAY)
+# AND tagnameid = $self->{upvoteid}
+# AND inactivated IS NULL");
+# my $max_clout = defined($constants->{tagbox_despam_upvotermaxclout})
+# ? $constants->{tagbox_despam_upvotermaxclout} : '0.85';
+# for my $upvoter (@$upvoter_ar) {
+# main::tagboxLog("setting user $upvoter clout to max $max_clout for upvoting user $uid");
+# $slashdb->setUser($upvoter, {
+# -tag_clout => "MAX(tag_clout, $max_clout)"
+# });
+# }
+#
+# # Next, insert tagboxlog_feeder entries to tell the relevant
+# # tagboxes to recalculate those scores.
+# my $tagboxes = $tagboxdb->getTagboxes();
+# my @tagboxids = map { $_->{tbid} } grep { $_->{name} =~ /^(FHEditorPop|FireHoseScores)$/ } @$tagboxes;
+# my $globjid_tagid = $slashdb->sqlSelectAllKeyValue(
+# 'firehose.globjid, tagid',
+# 'firehose, tags',
+# "firehose.uid=$uid
+# AND firehose.globjid=tags.globjid
+# AND tags.uid=$uid
+# AND tagnameid=$self->{upvoteid}",
+# 'GROUP BY firehose.globjid');
+# for my $globjid (sort keys %$globjid_tagid) {
+# for my $tbid (@tagboxids) {
+# $tagboxdb->addFeederInfo($tbid, {
+# affected_id => $globjid,
+# importance => 1,
+# tagid => $globjid_tagid->{ $globjid },
+# });
+# }
+# }
+#}
+
1;
Modified: slashjp/branches/upstream/current/themes/slashcode/THEME
===================================================================
--- slashjp/branches/upstream/current/themes/slashcode/THEME 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/themes/slashcode/THEME 2008-04-01 03:35:14 UTC (rev 560)
@@ -1,4 +1,4 @@
-# $Id: THEME,v 1.129 2008/02/21 01:01:52 pudge Exp $
+# $Id: THEME,v 1.131 2008/03/14 17:57:33 scc Exp $
name=slashcode
description="Slashcode.com theme"
topic=htdocs/images/topics/topicbug.jpg
@@ -127,7 +127,6 @@
htdoc=htdocs/topics.pl
htdoc=htdocs/users.pl
htdoc=htdocs/images/comments.js
-htdoc=htdocs/images/comments2.js
htdoc=htdocs/images/dumper.js
htdoc=htdocs/badge.pl
htdoc=htdocs/help.pl
@@ -340,6 +339,7 @@
plugin=Login
plugin=Hof
plugin=Messages
+plugin=Moderation
plugin=PollBooth
plugin=Print
plugin=PubKey
Modified: slashjp/branches/upstream/current/themes/slashcode/htdocs/comments.pl
===================================================================
--- slashjp/branches/upstream/current/themes/slashcode/htdocs/comments.pl 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/themes/slashcode/htdocs/comments.pl 2008-04-01 03:35:14 UTC (rev 560)
@@ -2,7 +2,7 @@
# This code is a part of Slash, and is released under the GPL.
# Copyright 1997-2005 by Open Source Technology Group. See README
# and COPYING for more information, or see http://slashcode.com/.
-# $Id: comments.pl,v 1.270 2008/02/28 19:26:58 pudge Exp $
+# $Id: comments.pl,v 1.272 2008/03/20 07:30:29 pudge Exp $
use strict;
use Slash 2.003; # require Slash 2.3.x
@@ -203,7 +203,7 @@
header($title, $section) or return;
$header_emitted = 1;
}
- print getError('login error');
+ print Slash::Utility::Comments::getError('login error');
$op = 'preview';
}
$op = 'default' if
@@ -217,7 +217,7 @@
header($title, $section) or return;
$header_emitted = 1;
}
- print getError("nosubscription");
+ print Slash::Utility::Comments::getError("nosubscription");
}
#print STDERR scalar(localtime) . " $$ B op=$op header_emitted=$header_emitted\n";
@@ -369,18 +369,6 @@
return fixurl($uri);
}
-#################################################################
-# this groups all the errors together in
-# one template, called "errors;comments;default"
-# Why not just getData??? -Brian
-sub getError {
- my($value, $hashref, $nocomm) = @_;
- $hashref ||= {};
- $hashref->{value} = $value;
- return slashDisplay('errors', $hashref,
- { Return => 1, Nocomm => $nocomm });
-}
-
##################################################################
sub delete {
my($form, $slashdb, $user, $constants) = @_;
@@ -449,7 +437,7 @@
if ($sid) { $sid =~ /(\d+)/; $sid = $1 }
if (!$sid) {
# Need a discussion ID to reply to, or there's no point.
- print getError('no sid');
+ print Slash::Utility::Comments::getError('no sid');
return;
}
@@ -461,7 +449,7 @@
# An attempt to reply to a comment that doesn't exist is an error.
if ($pid && !%$reply) {
- print getError('no such parent');
+ print Slash::Utility::Comments::getError('no such parent');
return;
} elsif ($pid) {
$pid_reply = prepareQuoteReply($reply);
@@ -485,12 +473,12 @@
# just in case the user fudged it.
if (($user->{is_anon} || $form->{postanon})
&& !$slashdb->checkAllowAnonymousPosting($user->{uid})) {
- print getError('anonymous disallowed');
+ print Slash::Utility::Comments::getError('anonymous disallowed');
return;
}
if ($discussion->{type} eq 'archived') {
- print getError('archive_error');
+ print Slash::Utility::Comments::getError('archive_error');
return;
}
@@ -498,12 +486,7 @@
$preview = previewForm(\$error_message, $discussion) or $error_flag++;
}
- if (%$reply && !$form->{postersubj}) {
- $form->{postersubj} = decode_entities($reply->{subject});
- $form->{postersubj} =~ s/^Re://i;
- $form->{postersubj} =~ s/\s\s/ /g;
- $form->{postersubj} = "Re:$form->{postersubj}";
- }
+ preProcessReplyForm($form, $reply);
my $extras = [];
my $disc_skin = $slashdb->getSkin($discussion->{primaryskid});
@@ -514,8 +497,10 @@
if $disc_skin && $disc_skin->{nexus};
my $gotmodwarning;
- $gotmodwarning = 1 if $form->{gotmodwarning}
- || $error_message && $error_message eq getError("moderations to be lost");
+ $gotmodwarning = 1 if $form->{gotmodwarning} ||
+ ($error_message && $error_message eq
+ Slash::Utility::Comments::getError("moderations to be lost")
+ );
slashDisplay('edit_comment', {
pid_reply => $pid_reply,
@@ -542,7 +527,7 @@
my $comment = preProcessComment($form, $user, $discussion, $error_message) or return;
return $$error_message if $comment eq '-1';
- my $preview = postProcessComment({ %$comment, %$user }, 0, $discussion);
+ my $preview = postProcessComment({ %$user, %$form, %$comment }, 0, $discussion);
if ($constants->{plugin}{Subscribe}) {
$preview->{subscriber_bonus} =
@@ -685,9 +670,9 @@
# went wrong.
if ($ret_val < 0) {
if ($ret_val == -1) {
- print getError('no points');
+ print Slash::Utility::Comments::getError('no points');
} elsif ($ret_val == -2){
- print getError('not enough points');
+ print Slash::Utility::Comments::getError('not enough points');
}
} else {
$was_touched += $ret_val;
Modified: slashjp/branches/upstream/current/themes/slashcode/htdocs/images/comments.js
===================================================================
(Binary files differ)
Deleted: slashjp/branches/upstream/current/themes/slashcode/htdocs/images/comments2.js
===================================================================
(Binary files differ)
Modified: slashjp/branches/upstream/current/themes/slashcode/htdocs/images/dumper.js
===================================================================
(Binary files differ)
Modified: slashjp/branches/upstream/current/themes/slashcode/templates/dispComment;misc;default
===================================================================
--- slashjp/branches/upstream/current/themes/slashcode/templates/dispComment;misc;default 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/themes/slashcode/templates/dispComment;misc;default 2008-04-01 03:35:14 UTC (rev 560)
@@ -34,7 +34,7 @@
[% ELSE %]
[% subject %]
[%- END %]
- [% UNLESS user.noscores %][% END %]
+ [% UNLESS user.noscores %][% END %]
by
@@ -81,4 +81,4 @@
__seclev__
10000
__version__
-$Id: dispComment;misc;default,v 1.64 2007/10/25 02:12:17 pudge Exp $
+$Id: dispComment;misc;default,v 1.66 2008/03/19 08:25:31 pudge Exp $
Modified: slashjp/branches/upstream/current/themes/slashcode/templates/dispLinkComment;misc;default
===================================================================
--- slashjp/branches/upstream/current/themes/slashcode/templates/dispLinkComment;misc;default 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/themes/slashcode/templates/dispLinkComment;misc;default 2008-04-01 03:35:14 UTC (rev 560)
@@ -22,14 +22,14 @@
[
[% IF !user.state.discussion_archived && !user.state.discussion_future_nopost %]
- [% Slash.linkComment({
+
[% Slash.linkComment({
sid => sid,
pid => cid,
op => 'Reply',
subject => 'Reply to This',
subject_only => 1,
- onclick => ((discussion2 && user.test_code) ? "replyTo($cid); return false;" : '')
- }) %]
+ onclick => ((discussion2 && (!constants.subscribe || user.is_subscriber)) ? "replyTo($cid); return false;" : '')
+ }) %]
[% END %]
[% IF !(user.state.discussion_archived) && ( do_parent || can_mod || can_del ) %] | [% END %]
@@ -68,4 +68,4 @@
__seclev__
10000
__version__
-$Id: dispLinkComment;misc;default,v 1.40 2008/02/28 19:26:58 pudge Exp $
+$Id: dispLinkComment;misc;default,v 1.43 2008/03/19 21:09:47 pudge Exp $
Modified: slashjp/branches/upstream/current/themes/slashcode/templates/dispStory;misc;default
===================================================================
--- slashjp/branches/upstream/current/themes/slashcode/templates/dispStory;misc;default 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/themes/slashcode/templates/dispStory;misc;default 2008-04-01 03:35:14 UTC (rev 560)
@@ -71,7 +71,7 @@
[% mypagemenu = PROCESS pagemenu; IF mypagemenu %]
[% mypagemenu %][% END %]
-[% IF full && user.is_admin && !preview && env.script_name != '/admin.pl' %]
[ Edit ] [% IF constants.plugin.Ajax %][% PROCESS signoff stoid = story.stoid %] [% PROCESS neverdisplay stoid = stoid %][% END %][% END %]
+[% IF full && user.is_admin && !preview && env.script_name != '/admin.pl' %]
[ Edit ] [% END %]
+[% IF full && !preview && env.script_name != '/admin.pl' %]
+ [% IF constants.plugin.Ajax %]
+ [% IF user.is_admin || user.acl.signoff_allowed %]
+ [% PROCESS signoff stoid = story.stoid %]
+ [% END %]
+ [% IF user.is_admin %]
+ [% PROCESS neverdisplay stoid = stoid %]
+ [% END %]
+ [% END %]
+[% END %]
[% IF story.is_future && !user.is_admin %]
See any serious problems with this story?
[% IF constants.ircslash_remarks %]
@@ -164,4 +174,4 @@
__seclev__
10000
__version__
-$Id: dispStory;misc;default,v 1.67 2007/10/24 00:30:08 scc Exp $
+$Id: dispStory;misc;default,v 1.69 2008/03/18 20:33:39 tvroom Exp $
Modified: slashjp/branches/upstream/current/themes/slashcode/templates/errors;comments;default
===================================================================
--- slashjp/branches/upstream/current/themes/slashcode/templates/errors;comments;default 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/themes/slashcode/templates/errors;comments;default 2008-04-01 03:35:14 UTC (rev 560)
@@ -34,7 +34,7 @@
to do so, because open proxies are used to spam web boards like this
one. [% IF constants.comments_portscan!=2 %]If you really can't close it and still want to post, you'll have to
register and log in.[% END %]
-
If you have questions, mention that your proxy is at
+If you have questions, mention that your proxy is at
[% unencoded_ip %] on port [% port %].
[% # COMMENT TABLE NOT AVAILABLE FOR WRITING
@@ -69,133 +69,128 @@
[% # NO POINTS.
CASE "no points" %]
-You don't have any moderator points.
+You don't have any moderator points.
[% # NO POINTS.
CASE "not enough points" %]
-You don't have enough moderator points.
+You don't have enough moderator points.
[% # COMMENTS MAX POSTS.
CASE "comments max posts" %]
-
You've reached your maximum number of comments you can post: [% max_posts %] comments over [% timeframe %].
-
+You've reached your maximum number of comments you can post: [% max_posts %] comments over [% timeframe %].
[% # COMMENTS MAX POSTS.
CASE "discussions max posts" %]
-
You've reached your maximum number of discussions you can submit: [% max_posts %] discussions over [% timeframe %].
-
+You've reached your maximum number of discussions you can submit: [% max_posts %] discussions over [% timeframe %].
[% # INVALID FORMKEY
CASE "invalid formkey" %]
-[% PROCESS titlebar width="100%" title="Invalid form key!" %]
-
form key: [% formkey %] !
+[% PROCESS titlebar width="100%" title="Invalid form key!" UNLESS no_titlebar %]
+Invalid form key: [% formkey %]!
[% # RESPONSE LIMIT
CASE "comments response limit" %]
-[% PROCESS titlebar width="100%" title="Slow Down Cowboy!" %]
-
[% constants.sitename %] requires you to wait [% limit %] between
-hitting 'reply' and submitting a comment.
-
It's been [% response %] since you hit 'reply'!
+[% PROCESS titlebar width="100%" title="Slow Down Cowboy!" UNLESS no_titlebar %]
+[% constants.sitename %] requires you to wait [% limit %] between hitting 'Reply'
+and submitting a comment. It's been [% response %] since you hit 'Reply.'
[% # POST LIMIT
CASE "comments post limit" %]
-[% PROCESS titlebar width="100%" title="Slow Down Cowboy!" %]
-
[% constants.sitename %] requires you to wait between
-each successful posting of a comment to allow everyone a fair chance
-at posting a comment.
-
It's been [% interval %] since you last successfully posted a comment.
+[% PROCESS titlebar width="100%" title="Slow Down Cowboy!" UNLESS no_titlebar %]
+[% constants.sitename %] requires you to wait between each successful posting of
+a comment to allow everyone a fair chance at posting a comment. It's been
+[% interval %] since you last successfully posted a comment.
[% # POST LIMIT
CASE "discussions post limit" %]
-[% PROCESS titlebar width="100%" title="Slow Down Cowboy!" %]
-
[% constants.sitename %] requires you to wait between
-each successful creation of a discussion .
-
It's been [% interval %] since you last successfully created a discussion.
+[% PROCESS titlebar width="100%" title="Slow Down Cowboy!" UNLESS no_titlebar %]
+[% constants.sitename %] requires you to wait between each successful creation
+of a discussion. It's been [% interval %] since you last successfully created a discussion.
+
[% # USED FORM
CASE "used form" %]
-[% PROCESS titlebar width="100%" title="Form Error!" %]
+[% PROCESS titlebar width="100%" title="Form Error!" UNLESS no_titlebar %]
This form has been used already to submit a comment [% interval %] ago.
You can not use a form and hit the back button to use it again.
[% # READ ONLY
CASE "readonly" %]
-
You can't post to this page.
+You can't post to this page.
[% # TOO MANY POSTS
CASE "comments post limit daily" %]
-[% PROCESS titlebar width="100%" title="Call It A Night, Cowboy!" %]
-
[% constants.sitename %] only allows
-[% IF user.is_anon; "anonymous users";
-ELSE; "a user with your karma"; END %]
-to post [% limit %] times per day (more or less, depending on
-moderation).
-[% IF user.is_anon; "A user from your IP has already shared his or her thoughts";
-ELSE; "You've already shared your thoughts"; END %]
+[% PROCESS titlebar width="100%" title="Call It A Night, Cowboy!" UNLESS no_titlebar %]
+[% constants.sitename %] only allows
+[% IF user.is_anon;
+ "anonymous users";
+ELSE;
+ "a user with your karma"; END %]
+to post [% limit %] times per day (more or less, depending on moderation).
+
+[% IF user.is_anon;
+ "A user from your IP has already shared his or her thoughts";
+ELSE;
+ "You've already shared your thoughts"; END %]
with us that many times. Take a breather, and come back and see us in
24 hours or so.
-
If you think this is unfair, please email
-[% IF constants.adminmail_post; constants.adminmail_post;
-ELSE; constants.adminmail; END %]
-with your
+
+If you think this is unfair, please email
+[% constants.adminmail_post || constants.adminmail %] with your
[% IF user.is_anon %]
-MD5'd IPID, which is [% user.ipid %][%
-ELSE %]
-username "[% user.nickname | strip_literal %]"[%
-END %]. Let us know how many comments you think you've
-posted in the last 24 hours.
+ MD5'd IPID, which is [% user.ipid %][% ELSE %]
+ username "[% user.nickname | strip_literal %]"[% END %].
+Let us know how many comments you think you've posted in the last 24 hours.
+
+
[% # TROLL MESSAGE.
CASE "troll message" %]
Due to excessive bad posting from this IP or Subnet, [% IF logged_in_allowed
-%]anonymous [% END %]comment posting
-has temporarily been disabled.
+%]anonymous [% END %]comment posting has temporarily been disabled.
+
[% IF logged_in_allowed %]
You can still login to post. However, if bad posting continues from your IP
or Subnet that privilege could be revoked as well.
[% END %]
-If it's you, consider this a chance to
-sit in the timeout corner[% IF logged_in_allowed %] or login and improve your posting[% END %]
-. If it's someone else, this is a chance to hunt them down.
-If you think this is unfair, please email
-[% IF constants.adminmail_mod; constants.adminmail_mod;
-ELSE; constants.adminmail; END %]
-with your MD5'd IPID and SubnetID, which are
-"[% user.ipid %]" and "[% user.subnetid %]"[%
-IF !user.is_anon %]
-and (optionally, but preferably) your IP number
-"[% unencoded_ip %]" and your username "[% user.nickname | strip_literal %]"[%
-END %].
+If it's you, consider this a chance to sit in the timeout
+corner[% IF logged_in_allowed %] or login and improve your posting[% END %].
+If it's someone else, this is a chance to hunt them down. If you think this is
+unfair, please email [% constants.adminmail_mod || constants.adminmail %]
+with your MD5'd IPID and SubnetID, which are "[% user.ipid %]" and
+"[% user.subnetid %]"[% IF !user.is_anon %]
+ and (optionally, but preferably) your IP number
+ "[% unencoded_ip %]" and your username
+ "[% user.nickname | strip_literal %]"[% END %].
+
[% CASE "broken html" %]
Your comment could not be processed. Please try again.
[% # LOW CHARS-PER-LINE
CASE "low chars-per-line" %]
-Your comment has too few characters per line (currently [% ratio %]).
+Your comment has too few characters per line (currently [% ratio %]).
[% # FILTER MESSAGE.
CASE "filter message" %]
-[% PROCESS titlebar width="100%" title="Lameness filter encountered. Post aborted!" %]
+[% PROCESS titlebar width="100%" title="Lameness filter encountered. Post aborted!" UNLESS no_titlebar %]
[% IF err_message %]
-Reason: [% err_message %]
+Filter error: [% err_message %]
[% END %]
[% # COMPRESS FILTER.
CASE "compress filter" %]
-[% PROCESS titlebar width="100%" title="Lameness filter encountered." %]
-Your comment violated the "[% ratio %]" compression filter. Try less
-whitespace and/or less repetition[%
-IF ratio == 'postersubj' %] in the subject line[% END %].
-Comment aborted.
+[% PROCESS titlebar width="100%" title="Lameness filter encountered." UNLESS no_titlebar %]
+Your comment violated the "[% ratio %]" compression filter. Try less whitespace
+and/or less repetition[% IF ratio == 'postersubj' %] in the subject line[% END %].
[% # SUBMISSION ERROR.
CASE "submission error" %]
-
There was an unknown error in the submission.
+There was an unknown error in the submission.
[% # MAXCID EXCEEDED.
CASE "maxcid exceeded" %]
-Don't you have anything better to do with your life?
+Don't you have anything better to do with your life?
[% # DUPLICATION ERROR.
CASE "duplication error" %]
@@ -214,31 +209,30 @@
form [% formname %] [% formkey %] already submitted
[% CASE "seclevtoolow" %]
-[% PROCESS titlebar width="100%" title="No permissions" %]
+[% PROCESS titlebar width="100%" title="No permissions" UNLESS no_titlebar %]
You do not have appropriate permissions to perform that action.
[% CASE "nosubscription" %]
-[% PROCESS titlebar width="100%" title="Not subscriber, or not subscribed page" %]
-You can't see this discussion because it's scheduled in the future,
-where only subscribers can see it.
-Either you are not a subscriber to [% constants.sitename %], or you
-have indicated you don't want comments pages ad-free, or you have
-set your daily limit of ad-free pages to lower than
-the default [% constants.subscribe_hits_btmd %].
-Any of these three possible issues can be resolved at
-your subscription page.
+[% PROCESS titlebar width="100%" title="Not subscriber, or not subscribed page" UNLESS no_titlebar %]
+You can't see this discussion because it's scheduled in the future, where only
+subscribers can see it. Either you are not a subscriber to
+[% constants.sitename %], or you have indicated you don't want comments pages
+ad-free, or you have set your daily limit of ad-free pages to lower than the
+default [% constants.subscribe_hits_btmd %]. Any of these three possible
+issues can be resolved at your
+subscription page.
[% CASE "moderations to be lost" %]
-[% PROCESS titlebar width="100%" title="You've Already Moderated this Discussion" %]
+[% PROCESS titlebar width="100%" title="You've Already Moderated this Discussion" UNLESS no_titlebar %]
If you continue to post this comment, all moderations done to this discussion will
be undone! Are you sure you want to post?
[% # NO DISCUSSION ID SPECIFIED
CASE "no sid" %]
-[% PROCESS titlebar width="100%" title="No Discussion Specified" %]
-You did not specify a discussion ID. If you clicked on a link internal
-to [% constants.sitename %], this is a bug. If not, someone sent you
-to a silly invalid URL.
+[% PROCESS titlebar width="100%" title="No Discussion Specified" UNLESS no_titlebar %]
+You did not specify a discussion ID. If you clicked on a link internal to
+[% constants.sitename %], this is a bug. If not, someone sent you to a silly
+invalid URL.
[% CASE 'no_moderation' %]
The moderation system is currently down.
@@ -248,10 +242,10 @@
[% CASE %]
-An unexpected error has occurred.
[% value %]
+An unexpected error has occurred: [% value %]
[% END %]
__seclev__
1000
__version__
-$Id: errors;comments;default,v 1.39 2006/09/12 04:44:07 pudge Exp $
+$Id: errors;comments;default,v 1.42 2008/03/12 06:25:50 pudge Exp $
Modified: slashjp/branches/upstream/current/themes/slashcode/templates/html-header;misc;default
===================================================================
--- slashjp/branches/upstream/current/themes/slashcode/templates/html-header;misc;default 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/themes/slashcode/templates/html-header;misc;default 2008-04-01 03:35:14 UTC (rev 560)
@@ -28,7 +28,7 @@
[% IF file.ie_cond %][% END %]
[% END -%]
[%- IF constants.plugin.Ajax %]
-
+
@@ -56,4 +56,4 @@
__seclev__
10000
__version__
-$Id: html-header;misc;default,v 1.38 2008/02/04 14:50:17 scc Exp $
+$Id: html-header;misc;default,v 1.39 2008/03/14 15:48:07 scc Exp $
Modified: slashjp/branches/upstream/current/themes/slashcode/templates/modCommentLog;misc;default
===================================================================
--- slashjp/branches/upstream/current/themes/slashcode/templates/modCommentLog;misc;default 2008-03-31 12:09:17 UTC (rev 559)
+++ slashjp/branches/upstream/current/themes/slashcode/templates/modCommentLog;misc;default 2008-04-01 03:35:14 UTC (rev 560)
@@ -36,15 +36,17 @@
__template__
[% IF mod_admin %]
[%
+hr_shown = 0; mod_index = 0;
down=0; cnt=0; m2_down=0; m2_count=0; m2_offside=0;
+a_up=0; a_sum=0; a_count=0; up=0; sum=0; count=0; a_m2_count=0;
a_down=0; a_cnt=0; a_m2_down=0; a_m2_up=0; m2_count=0; a_m2_offside=0; a_m2_unfair_votes=0; unanimous = 0; unresolved=0;
show_uid_totals = (type == "uid" && (this_user.totalmods || this_user.downmods || this_user.upmods || this_user.m2unfair || this_user.m2unfairpercent || this_user.stirred));
bg_toggle = 0;
%]
[% IF mods.size > 0 || show_uid_totals %]
- [% IF user.is_admin and need_m2_form %]
-