From svnnotify @ sourceforge.jp Fri Nov 2 16:50:14 2007 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Fri, 02 Nov 2007 16:50:14 +0900 Subject: [Slashdotjp-dev 728] [237] merged from T_2_5_0_182 Message-ID: <1193989814.867417.17797.nullmailer@users.sourceforge.jp> Revision: 237 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=237 Author: tach Date: 2007-11-02 16:50:12 +0900 (Fri, 02 Nov 2007) Log Message: ----------- merged from T_2_5_0_182 Modified Paths: -------------- slashjp/branches/upstream/current/Bundle/Slash.pm slashjp/branches/upstream/current/Slash/DB/MySQL/MySQL.pm slashjp/branches/upstream/current/Slash/Slash.pm slashjp/branches/upstream/current/plugins/Admin/admin.pl slashjp/branches/upstream/current/plugins/Admin/templates/editStory;admin;default slashjp/branches/upstream/current/plugins/Admin/templates/static_files;admin;default slashjp/branches/upstream/current/plugins/Ajax/PLUGIN slashjp/branches/upstream/current/plugins/Ajax/htdocs/ajax.pl slashjp/branches/upstream/current/plugins/Ajax/htdocs/images/admin.js slashjp/branches/upstream/current/plugins/Ajax/htdocs/images/common.js slashjp/branches/upstream/current/plugins/Blob/Blob.pm slashjp/branches/upstream/current/plugins/Bookmark/bookmark.pl slashjp/branches/upstream/current/plugins/Bookmark/mysql_dump.sql slashjp/branches/upstream/current/plugins/Bookmark/mysql_schema.sql slashjp/branches/upstream/current/plugins/FireHose/FireHose.pm slashjp/branches/upstream/current/plugins/FireHose/PLUGIN slashjp/branches/upstream/current/plugins/FireHose/mysql_schema.sql slashjp/branches/upstream/current/plugins/FireHose/templates/dispFireHose;firehose;default slashjp/branches/upstream/current/plugins/FireHose/templates/nodnix_menus;firehose;default slashjp/branches/upstream/current/plugins/HumanConf/Static/Static.pm slashjp/branches/upstream/current/plugins/Journal/Journal.pm slashjp/branches/upstream/current/plugins/Journal/mysql_schema slashjp/branches/upstream/current/plugins/Login/login.pl slashjp/branches/upstream/current/plugins/Metamod/templates/dispTheComments;metamod;default slashjp/branches/upstream/current/plugins/ResKey/mysql_dump.sql slashjp/branches/upstream/current/plugins/Tags/Tags.pm slashjp/branches/upstream/current/plugins/Tags/templates/tagsstorydivadmin;misc;default slashjp/branches/upstream/current/plugins/Tags/templates/tagsurldivadmin;misc;default slashjp/branches/upstream/current/sql/mysql/defaults.sql slashjp/branches/upstream/current/sql/mysql/slashschema_create.sql slashjp/branches/upstream/current/sql/mysql/upgrades slashjp/branches/upstream/current/tagboxes/Top/Top.pm slashjp/branches/upstream/current/tagboxes/Top/mysql_dump.sql slashjp/branches/upstream/current/themes/slashcode/htdocs/comments.css slashjp/branches/upstream/current/themes/slashcode/htdocs/images/comments.js slashjp/branches/upstream/current/themes/slashcode/htdocs/users.pl slashjp/branches/upstream/current/themes/slashcode/tasks/process_file_queue.pl slashjp/branches/upstream/current/themes/slashcode/templates/edit_comment;comments;default Added Paths: ----------- slashjp/branches/upstream/current/plugins/Ajax/templates/prefs_d2_posting;ajax;default slashjp/branches/upstream/current/plugins/FireHose/firehose_get_thumbnails.pl slashjp/branches/upstream/current/plugins/FireHose/templates/dispTopicFireHose;misc;default slashjp/branches/upstream/current/plugins/ResKey/ResKey/Checks/AL2/Spammer.pm slashjp/branches/upstream/current/tagboxes/Despam/ slashjp/branches/upstream/current/tagboxes/Despam/Despam.pm slashjp/branches/upstream/current/tagboxes/Despam/Makefile.PL slashjp/branches/upstream/current/tagboxes/Despam/TAGBOX slashjp/branches/upstream/current/tagboxes/Despam/mysql_dump.sql -------------- next part -------------- Modified: slashjp/branches/upstream/current/Bundle/Slash.pm =================================================================== --- slashjp/branches/upstream/current/Bundle/Slash.pm 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/Bundle/Slash.pm 2007-11-02 07:50:12 UTC (rev 237) @@ -1,7 +1,7 @@ package Bundle::Slash; # -# $Id: Slash.pm,v 1.46 2007/04/10 21:58:24 entweichen Exp $ +# $Id: Slash.pm,v 1.47 2007/11/01 20:35:18 jamiemccarthy Exp $ # $Bundle::Slash::VERSION = '2.52'; @@ -134,6 +134,6 @@ and thus not installed by default, but which may become required as you edit your site configuration, are: Cache::Memcached Silly::Werder GD GD::Text GD::Graph Apache::SSI Apache::RegistryFilter GraphViz -Net::IRC Proc::ProcessTable Net::Jabber +Net::IRC Proc::ProcessTable Net::Jabber File::Type =cut Modified: slashjp/branches/upstream/current/Slash/DB/MySQL/MySQL.pm =================================================================== --- slashjp/branches/upstream/current/Slash/DB/MySQL/MySQL.pm 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/Slash/DB/MySQL/MySQL.pm 2007-11-02 07:50:12 UTC (rev 237) @@ -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: MySQL.pm,v 1.989 2007/10/23 23:20:15 pudge Exp $ +# $Id: MySQL.pm,v 1.991 2007/11/01 20:35:18 jamiemccarthy Exp $ package Slash::DB::MySQL; use strict; @@ -20,7 +20,7 @@ use base 'Slash::DB::Utility'; use Slash::Constants ':messages'; -($VERSION) = ' $Revision: 1.989 $ ' =~ /\$Revision:\s+([^\s]+)/; +($VERSION) = ' $Revision: 1.991 $ ' =~ /\$Revision:\s+([^\s]+)/; # Fry: How can I live my life if I can't tell good from evil? @@ -5334,18 +5334,26 @@ sub checkAL2 { my($self, $srcids, $type) = @_; + my $type_ar = ref($type) ? $type : [ $type ]; # If the caller is querying about a type that does not # exist for this site, that's OK, it just means that no - # srcid can have it. So we can return without querying - # the DB. + # srcid can have it. If none of the types given exist, + # we can return without querying the DB. my $types = $self->getAL2Types(); - return 0 if !exists $types->{$type}; + my $any_exist = 0; + for my $t (@$type_ar) { + $any_exist = 1, last if exists $types->{$t}; + } + return 0 unless $any_exist; - # It's at least possible that the srcids have this type, - # so run the check. + # It's at least possible that the srcids have one or more + # of these types, so run the check. my $data = $self->getAL2($srcids); - return $data->{$type} ? 1 : 0; + for my $t (@$type_ar) { + return 1 if exists $types->{$t} && $data->{$type}; + } + return 0; } sub getAL2List { @@ -12460,9 +12468,10 @@ $self->sqlCount("file_queue", "stoid=$stoid_q"); } -sub addStoryStaticFile { +sub addStaticFile { my($self, $data) = @_; - $data ||= ""; + my $constants = getCurrentStatic(); + $data ||= {}; # Guess at file type if it isn't set if ($data->{name} =~ /\.(jpg|gif|png)$/) { @@ -12470,16 +12479,28 @@ } elsif ($data->{name} =~ /\.(jpg|gif|png)$/) { $data->{filetype} ||= "audio"; } + $data->{name} =~ s/^\Q$constants->{basedir}\E\/images//g; - $self->sqlInsert("story_static_files", $data); + $self->sqlInsert("static_files", $data); + my $sfid = $self->getLastInsertId; + return $sfid; } sub getStaticFilesForStory { my($self, $stoid) = @_; my $stoid_q = $self->sqlQuote($stoid); - return $self->sqlSelectAllHashrefArray("*", "story_static_files", "stoid=$stoid_q"); + return $self->sqlSelectAllHashrefArray("*", "static_files", "stoid=$stoid_q"); } +sub getStaticFile { + my $answer = _genericGetCache({ + table => 'static_files', + table_prime => 'sfid', + arguments => \@_, + }); + return $answer; +} + ######################################################## sub DESTROY { my($self) = @_; Modified: slashjp/branches/upstream/current/Slash/Slash.pm =================================================================== --- slashjp/branches/upstream/current/Slash/Slash.pm 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/Slash/Slash.pm 2007-11-02 07:50:12 UTC (rev 237) @@ -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: Slash.pm,v 1.339 2007/10/25 02:12:17 pudge Exp $ +# $Id: Slash.pm,v 1.340 2007/11/01 19:32:23 jamiemccarthy Exp $ package Slash; @@ -72,6 +72,8 @@ my($min, $max) = ($constants->{comment_minscore}, $constants->{comment_maxscore}); my $num_scores = $max - $min + 1; +# print STDERR scalar(gmtime) . " selectComments cid undef for $discussion\n" if !defined($cid); + $cid ||= 0; my $discussion2 = discussion2($user); @@ -139,8 +141,8 @@ # I'm still looking into how to get parent links and # children to show up properly in flat mode. - Jamie 2002/07/30 # $user->{state}{noreparent} = 1 if $commentsort > 3; - - $C->{points} = _get_points($C, $user, $min, $max, $max_uid, $reasons); +#my $errstr = "selectComments discid=$discussion->{id} cid=$cid options=" . Dumper($options); $errstr =~ s/\s+/ /g; + $C->{points} = _get_points($C, $user, $min, $max, $max_uid, $reasons); # , $errstr } my $d2_comment_q = $user->{d2_comment_q}; @@ -518,7 +520,8 @@ } sub _get_points { - my($C, $user, $min, $max, $max_uid, $reasons) = @_; + my($C, $user, $min, $max, $max_uid, $reasons, $errstr) = @_; +#use Data::Dumper; print STDERR scalar(gmtime) . " _get_points errstr='$errstr' C: " . Dumper($C) if !defined($C->{pointsorig}) || !defined($C->{tweak_orig}) || !defined($C->{points}) || !defined($C->{tweak}); my $hr = { score_start => constrain_score($C->{pointsorig} + $C->{tweak_orig}), moderations => constrain_score($C->{points} + $C->{tweak}) - constrain_score($C->{pointsorig} + $C->{tweak_orig}), @@ -719,7 +722,8 @@ # But, if all its (great-etc.) grandparents are either invisible # or chronologically precede the root comment, don't reparent it # at all. - if ($user->{reparent} && $comments->{$x}{points} >= $threshold) { # XXX either $comments->{$x}{points} or $threshold is undefined here, not sure which or why + # XXX either $comments->{$x}{points} or $threshold is sometimes undefined here, not sure which or why + if ($user->{reparent} && $comments->{$x}{points} >= $threshold) { my $tmppid = $pid; while ($tmppid && $comments->{$tmppid} && defined($comments->{$tmppid}{points}) @@ -1618,14 +1622,14 @@ # Only do the following if force_cache_freshen is not set: # as it is by freshenup.pl when (re)building the 'rendered' # cached data for a story. - my $df = ($user->{mode} eq "archive" || ($story->{is_archived} eq "yes" && $user->{is_anon})) - ? $constants->{archive_dateformat} : ""; - my $storytime = timeCalc($story->{'time'}, $df); + my $is_old = $user->{mode} eq 'archive' || ($story->{is_archived} eq 'yes' && $user->{is_anon}); + my $df = $is_old ? $constants->{archive_dateformat} : ''; my $atstorytime; if ($options->{is_future} && !($user->{author} || $user->{is_admin})) { $atstorytime = $constants->{subscribe_future_name}; } else { - $atstorytime = $user->{aton} . " " . timeCalc($story->{'time'}, $df); + $atstorytime = $user->{aton} . ' ' + . timeCalc($story->{'time'}, $df, 0, { is_old => $is_old }); } $return =~ s/\Q__TIME_TAG__\E/$atstorytime/; Modified: slashjp/branches/upstream/current/plugins/Admin/admin.pl =================================================================== --- slashjp/branches/upstream/current/plugins/Admin/admin.pl 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/plugins/Admin/admin.pl 2007-11-02 07:50:12 UTC (rev 237) @@ -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: admin.pl,v 1.323 2007/10/24 00:30:06 scc Exp $ +# $Id: admin.pl,v 1.324 2007/10/30 20:21:09 tvroom Exp $ use strict; use File::Temp 'tempfile'; @@ -2018,7 +2018,7 @@ my $time = findTheTime(); - for my $field (qw( introtext bodytext )) { + for my $field (qw( introtext bodytext media)) { local $Slash::Utility::Data::approveTag::admin = 2; $form->{$field} = cleanSlashTags($form->{$field}); $form->{$field} = strip_html($form->{$field}); @@ -2057,8 +2057,10 @@ commentstatus => $form->{commentstatus}, bodytext => $form->{bodytext}, introtext => $form->{introtext}, + media => $form->{media}, relatedtext => $form->{relatedtext}, related_sids => $related_sids, + thumb => $form->{thumb}, -rendered => 'NULL', # freshenup.pl will write this is_dirty => 1 }; @@ -2144,7 +2146,7 @@ if ($savefile) { close $ofh; } - my $action = $form->{media_action} eq "thumbnails" ? "thumbnails" : "upload"; + my $action = "upload"; my $file = { stoid => $stoid, action => $action, @@ -2455,9 +2457,11 @@ bodytext => $form->{bodytext}, introtext => $form->{introtext}, relatedtext => $form->{relatedtext}, + media => $form->{media}, subid => $form->{subid}, fhid => $form->{fhid}, commentstatus => $form->{commentstatus}, + thumb => $form->{thumb}, -rendered => 'NULL', # freshenup.pl will write this }; Modified: slashjp/branches/upstream/current/plugins/Admin/templates/editStory;admin;default =================================================================== --- slashjp/branches/upstream/current/plugins/Admin/templates/editStory;admin;default 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/plugins/Admin/templates/editStory;admin;default 2007-11-02 07:50:12 UTC (rev 237) @@ -248,26 +248,39 @@ - + [% IF story_static_files && story_static_files.size %] + [% FOREACH mfile = story_static_files %] - [% trunc_name = mfile.name %] - [% trunc_name = trunc_name.replace('^\d+',"") %] - - + [% filename = mfile.name %] + [% filename = filename.replace(".*\/", ""); %] + + [% END %] +
Select
Thumb
Click to
add to body
[% mfile.sfid %][% mfile.name %][% constants.imagedir %]/articles/[% sid %][% trunc_name %][% mfile.width %]
[% filename %][% mfile.width %] [% mfile.height %] [% IF mfile.filetype == "image" %] - +[% height = mfile.height; width = mfile.width %] +[% IF width && height %] + [% WHILE (height > 225 || width > 225) %] + [% height = height / 1.3 %] + [% width = width / 1.3 %] + [% END %] + [% width = width.int %] + [% height = height.int %] [% END %] + +[% ELSE %] +Add [% filename %] +[% END %]
None
[% END %] @@ -275,10 +288,15 @@ Upload a file for bodytext + - + + +
[% ispell_comments.bodytext %]
[% PROCESS editbuttons %] @@ -290,4 +308,4 @@ __seclev__ 10000 __version__ -$Id: editStory;admin;default,v 1.78 2007/10/23 20:58:47 tvroom Exp $ +$Id: editStory;admin;default,v 1.79 2007/10/30 20:21:09 tvroom Exp $ Modified: slashjp/branches/upstream/current/plugins/Admin/templates/static_files;admin;default =================================================================== --- slashjp/branches/upstream/current/plugins/Admin/templates/static_files;admin;default 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/plugins/Admin/templates/static_files;admin;default 2007-11-02 07:50:12 UTC (rev 237) @@ -15,11 +15,9 @@ __template__ [% FOREACH mfile = story_static_files %] - [% trunc_name = mfile.name %] - [% trunc_name = trunc_name.replace('^\d+',"") %] - + [% IF mfile.filetype == "image" %] - + [% END %] [% END %] @@ -28,4 +26,4 @@ __version__ -$Id: static_files;admin;default,v 1.2 2007/10/23 20:58:47 tvroom Exp $ +$Id: static_files;admin;default,v 1.3 2007/10/30 20:21:09 tvroom Exp $ Modified: slashjp/branches/upstream/current/plugins/Ajax/PLUGIN =================================================================== --- slashjp/branches/upstream/current/plugins/Ajax/PLUGIN 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/plugins/Ajax/PLUGIN 2007-11-02 07:50:12 UTC (rev 237) @@ -1,4 +1,4 @@ -# $Id: PLUGIN,v 1.27 2007/10/09 18:24:10 entweichen Exp $ +# $Id: PLUGIN,v 1.28 2007/11/02 03:13:51 entweichen Exp $ name=Ajax description="Ajax (Asynchronous Javascript and XML)" mysql_dump=mysql_dump.sql @@ -34,3 +34,4 @@ template=templates/sectionpref;ajax;default template=templates/datewidget;misc;default template=templates/prefs_d2;ajax;default +template=templates/prefs_d2_posting;ajax;default Modified: slashjp/branches/upstream/current/plugins/Ajax/htdocs/ajax.pl =================================================================== --- slashjp/branches/upstream/current/plugins/Ajax/htdocs/ajax.pl 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/plugins/Ajax/htdocs/ajax.pl 2007-11-02 07:50:12 UTC (rev 237) @@ -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: ajax.pl,v 1.58 2007/10/24 20:01:02 entweichen Exp $ +# $Id: ajax.pl,v 1.59 2007/10/31 19:54:17 entweichen Exp $ use strict; use warnings; @@ -14,7 +14,7 @@ use Slash::Utility; use vars qw($VERSION); -($VERSION) = ' $Revision: 1.58 $ ' =~ /\$Revision:\s+([^\s]+)/; +($VERSION) = ' $Revision: 1.59 $ ' =~ /\$Revision:\s+([^\s]+)/; ################################################################## sub main { @@ -520,16 +520,38 @@ my $url = URI->new('//e.a/?' . $form->{'data'}); my %params = $url->query_form; - # Specific to D2 for the time being - my $user_edits_table = { - d2_comment_q => $params{'d2_comment_q'} || undef, - d2_comment_order => $params{'d2_comment_order'} || undef, - nosigs => ($params{'nosigs'} ? 1 : 0), - noscores => ($params{'noscores'} ? 1 : 0), - domaintags => ($params{'domaintags'} != 2 ? $params{'domaintags'} : undef), - m2_with_comm_mod => ($params{'m2_with_mod_on_comm'} ? 1 : undef), - }; - + # Specific to D2 display and posting prefs for the time being. + my $user_edits_table; + if ($params{'formname'} eq 'd2_display') { + $user_edits_table = { + discussion2 => ($params{'discussion2'}) ? 'slashdot' : 'none', + d2_comment_q => $params{'d2_comment_q'} || undef, + d2_comment_order => $params{'d2_comment_order'} || undef, + nosigs => ($params{'nosigs'} ? 1 : 0), + noscores => ($params{'noscores'} ? 1 : 0), + domaintags => ($params{'domaintags'} != 2 ? $params{'domaintags'} : undef), + m2_with_comm_mod => ($params{'m2_with_mod_on_comm'} ? 1 : undef), + } + } + else { + my $karma_bonus = ($params{'karma_bonus'} !~ /^[\-+]?\d+$/) ? "+1" : $params{'karma_bonus'}; + my $subscriber_bonus = ($params{'subscriber_bonus'} !~ /^[\-+]?\d+$/) ? "+1" : $params{'subscriber_bonus'}; + $user_edits_table = { + emaildisplay => $params{'emaildisplay'} || undef, + karma_bonus => ($karma_bonus ne '+1' ? $karma_bonus : undef), + nobonus => ($params{'nobonus'} ? 1 : undef), + subscriber_bonus => ($subscriber_bonus || undef), + nosubscriberbonus => ($params{'nosubscriberbonus'} ? 1 : undef), + posttype => $params{'posttype'}, + textarea_rows => ($params{'textarea_rows'} != $constants->{'textarea_rows'} + ? $params{'textarea_rows'} : undef), + textarea_cols => ($params{'textarea_cols'} != $constants->{'textarea_cols'} + ? $params{'textarea_cols'} : undef), + postanon => ($params{'postanon'} ? 1 : undef), + no_spell => ($params{'no_spell'} ? 1 : undef), + }; + } + $slashdb->setUser($params{uid}, $user_edits_table); } Modified: slashjp/branches/upstream/current/plugins/Ajax/htdocs/images/admin.js =================================================================== --- slashjp/branches/upstream/current/plugins/Ajax/htdocs/images/admin.js 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/plugins/Ajax/htdocs/images/admin.js 2007-11-02 07:50:12 UTC (rev 237) @@ -1,4 +1,4 @@ -// $Id: admin.js,v 1.41 2007/10/24 00:30:06 scc Exp $ +// $Id: admin.js,v 1.42 2007/10/30 20:33:48 tvroom Exp $ function um_ajax(the_behaviors, the_events) { var params =[]; @@ -301,3 +301,11 @@ }; ajax_update(params, 'postform-'+id, handlers); } + +function appendToBodytext(text) { + var obj = $('admin-bodytext'); + if (obj) { + obj.className = "show"; + obj.value = obj.value + text; + } +} Modified: slashjp/branches/upstream/current/plugins/Ajax/htdocs/images/common.js =================================================================== --- slashjp/branches/upstream/current/plugins/Ajax/htdocs/images/common.js 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/plugins/Ajax/htdocs/images/common.js 2007-11-02 07:50:12 UTC (rev 237) @@ -1,5 +1,5 @@ // _*_ Mode: JavaScript; tab-width: 8; indent-tabs-mode: true _*_ -// $Id: common.js,v 1.147 2007/10/24 00:30:07 scc Exp $ +// $Id: common.js,v 1.149 2007/10/31 19:55:14 entweichen Exp $ var fh_play = 0; var fh_is_timed_out = 0; @@ -139,6 +139,17 @@ obj.className = ""; } +function toggleId(id, first, second) { + var obj =$(id); + if (obj.className == first) { + obj.className = second; + } else if (obj.className == second) { + obj.className = first; + } else { + obj.className = first; + } +} + function toggleIntro(id, toggleid) { var obj = $(id); var toggle = $(toggleid); @@ -1432,6 +1443,12 @@ params['op'] = 'saveModalPrefs'; params['data'] = Form.serialize(document.forms['modal_prefs']); params['reskey'] = reskey_static; - var handlers = {onComplete:hide_modal_box}; + var handlers = { + onComplete: function() { + hide_modal_box(); + if (document.forms['modal_prefs'].refreshable.value) + document.location=document.forms['modal_prefs'].refreshable.value; + } + }; ajax_update(params, '', handlers); } Added: slashjp/branches/upstream/current/plugins/Ajax/templates/prefs_d2_posting;ajax;default =================================================================== --- slashjp/branches/upstream/current/plugins/Ajax/templates/prefs_d2_posting;ajax;default 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/plugins/Ajax/templates/prefs_d2_posting;ajax;default 2007-11-02 07:50:12 UTC (rev 237) @@ -0,0 +1,140 @@ +__section__ +default +__description__ +__title__ + +__page__ +ajax +__lang__ +en_US +__name__ +prefs_d2_posting +__template__ + +[% hi = constants.comment_maxscore - constants.comment_minscore %] +[% lo = '-' _ hi %] +[% range = [ lo .. hi ] %] + + + + + + +
[% mfile.sfid %][% mfile.name %][% constants.imagedir %]/articles/[% sid %][% trunc_name %][% mfile.width %][% mfile.height %]
[% mfile.sfid %][% mfile.name %][% constants.imagedir %][% mfile.name %][% mfile.width %][% mfile.height %]
+ + + +
+  

+ + Email Display + (currently + [%- IF !user.fakeemail; " not displayed"; + ELSE; ": "; user.fakeemail | strip_literal; ""; + END %])
+ [% IF !user.emaildisplay.defined; + IF user.fakeemail %] + (Your current email address was apparently set before + users' email addresses were forced to one of the below + choices. Please pick one and click Save.)
+ [% END; + user.emaildisplay = 0; + END; + IF user.emaildisplay.defined; + emaildisplay.${user.emaildisplay} = constants.markup_checked_attribute; + END %] +

+ Do not display an e-mail address.
+ Show your email address with weekly updating spam armoring.
+ Show your real email address without cowering behind childish anonymity or obfuscation. +
+ + Karma Bonus (modifier assigned to posts where the user has good karma)
+ [% karma_bonus = 0; + IF user.karma_bonus; + karma_bonus = user.karma_bonus; + END %] + [% Slash.createSelect('karma_bonus', range, karma_bonus, 1, 1) %] + +  

+ + [% IF user.karma > constants.goodkarma; + b_check = ''; + IF user.nobonus; + b_check = constants.markup_checked_attribute; + END %] + + + +  

+ [% END %] + + Subscriber Bonus (modifier assigned to posts where the user was a subscriber)
+ [% subscriber_bonus = 0; + IF user.subscriber_bonus; + subscriber_bonus = user.subscriber_bonus; + END %] + [% Slash.createSelect('subscriber_bonus', range, subscriber_bonus, 1, 1) %] + +  

+ + [% IF user.is_subscriber; + sb_check = ''; + IF user.nosubscriberbonus; + sb_check = constants.markup_checked_attribute; + END %] + + + [% END %] + + + [% textarea_cols = constants.textarea_cols; + IF user.textarea_cols; + textarea_cols = user.textarea_cols; + END; + + textarea_rows = constants.textarea_rows; + IF user.textarea_rows; + textarea_rows = user.textarea_rows; + END %] + + Columns: + Rows: + [% PROCESS formNote note="Also applies to other large text boxes" %] + + + [% + formats = Slash.db.getDescriptions('postmodes'); + Slash.createSelect('posttype', formats, user.posttype, 1); + %] + +  

+ + [% + p_check = ''; + IF user.postanon; + p_check = constants.markup_checked_attribute; + END; + %] + + [% IF constants.allow_anonymous && (user.karma > -1 || p_check) %] + + + + [% END %] + + [% IF user.is_admin; + nospell_check = ''; + IF user.no_spell; + nospell_check = constants.markup_checked_attribute; + END %] + + [% END %] +

+ + +__seclev__ +500 +__version__ +$Id: prefs_d2_posting;ajax;default,v 1.1 2007/10/31 19:49:51 entweichen Exp $ Modified: slashjp/branches/upstream/current/plugins/Blob/Blob.pm =================================================================== --- slashjp/branches/upstream/current/plugins/Blob/Blob.pm 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/plugins/Blob/Blob.pm 2007-11-02 07:50:12 UTC (rev 237) @@ -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: Blob.pm,v 1.17 2007/10/24 19:11:10 tvroom Exp $ +# $Id: Blob.pm,v 1.18 2007/10/26 03:41:45 tvroom Exp $ package Slash::Blob; @@ -16,7 +16,7 @@ use base 'Exporter'; use base 'Slash::DB::Utility'; -($VERSION) = ' $Revision: 1.17 $ ' =~ /\$Revision:\s+([^\s]+)/; +($VERSION) = ' $Revision: 1.18 $ ' =~ /\$Revision:\s+([^\s]+)/; # When this plugin was first written, it used a hardcoded hash to # store MIME types. Now we use the MIME::Types module. But for @@ -179,7 +179,7 @@ sub get { my($self, $sig) = @_; my $sig_q = $self->sqlQuote($sig); - return $self->sqlSelectHashref($self->{_table}, "id = $sig_q"); + return $self->sqlSelectHashref("*", $self->{_table}, "id = $sig_q"); } sub getFilesForStories { Modified: slashjp/branches/upstream/current/plugins/Bookmark/bookmark.pl =================================================================== --- slashjp/branches/upstream/current/plugins/Bookmark/bookmark.pl 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/plugins/Bookmark/bookmark.pl 2007-11-02 07:50:12 UTC (rev 237) @@ -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: bookmark.pl,v 1.21 2007/07/12 14:18:05 tvroom Exp $ +# $Id: bookmark.pl,v 1.22 2007/11/01 20:35:18 jamiemccarthy Exp $ use strict; use Slash; @@ -110,6 +110,8 @@ url_id => $url_id, uid => $user->{uid}, title => strip_notags($form->{title}), + srcid_32 => get_srcid_sql_in($user->{srcids}{32}), + srcid_24 => get_srcid_sql_in($user->{srcids}{24}), }; my $bookmark_id; Modified: slashjp/branches/upstream/current/plugins/Bookmark/mysql_dump.sql =================================================================== --- slashjp/branches/upstream/current/plugins/Bookmark/mysql_dump.sql 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/plugins/Bookmark/mysql_dump.sql 2007-11-02 07:50:12 UTC (rev 237) @@ -1,5 +1,5 @@ # -# $Id: mysql_dump.sql,v 1.6 2006/04/18 20:30:24 tvroom Exp $ +# $Id: mysql_dump.sql,v 1.7 2007/11/01 20:35:18 jamiemccarthy Exp $ # INSERT IGNORE INTO reskey_vars VALUES (8,'duration_creation-use', 2, 'min duration (in seconds) between creation and use'); @@ -8,6 +8,7 @@ INSERT IGNORE INTO reskey_vars VALUES (8, 'duration_max-uses', '30', 'how many uses per timeframe'); INSERT INTO reskey_resource_checks (rkrcid, rkrid, type, class, ordernum) VALUES (NULL, 8,'use','Slash::ResKey::Checks::Post',151); +INSERT INTO reskey_resource_checks (rkrcid, rkrid, type, class, ordernum) VALUES (NULL, 8,'all','Slash::ResKey::Checks::Spammer',531); INSERT INTO reskey_resource_checks (rkrcid, rkrid, type, class, ordernum) VALUES (NULL, 8,'all','Slash::ResKey::Checks::Duration',601); INSERT INTO reskey_resource_checks (rkrcid, rkrid, type, class, ordernum) VALUES (NULL ,8,'all','Slash::ResKey::Checks::User',101); Modified: slashjp/branches/upstream/current/plugins/Bookmark/mysql_schema.sql =================================================================== --- slashjp/branches/upstream/current/plugins/Bookmark/mysql_schema.sql 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/plugins/Bookmark/mysql_schema.sql 2007-11-02 07:50:12 UTC (rev 237) @@ -5,8 +5,12 @@ url_id MEDIUMINT UNSIGNED NOT NULL, createdtime DATETIME NOT NULL, title VARCHAR(255), + srcid_32 BIGINT UNSIGNED NOT NULL DEFAULT 0, + srcid_24 BIGINT UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY(bookmark_id), - UNIQUE url_id_uid (url_id, uid) + UNIQUE url_id_uid (url_id, uid), + INDEX srcid_32 (srcid_32), + INDEX srcid_24 (srcid_24) ); DROP TABLE IF EXISTS bookmark_feeds; Modified: slashjp/branches/upstream/current/plugins/FireHose/FireHose.pm =================================================================== --- slashjp/branches/upstream/current/plugins/FireHose/FireHose.pm 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/plugins/FireHose/FireHose.pm 2007-11-02 07:50:12 UTC (rev 237) @@ -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.179 2007/10/25 02:12:17 pudge Exp $ +# $Id: FireHose.pm,v 1.182 2007/11/01 20:42:19 tvroom Exp $ package Slash::FireHose; @@ -42,7 +42,7 @@ use base 'Slash::DB::MySQL'; use vars qw($VERSION); -($VERSION) = ' $Revision: 1.179 $ ' =~ /\$Revision:\s+([^\s]+)/; +($VERSION) = ' $Revision: 1.182 $ ' =~ /\$Revision:\s+([^\s]+)/; sub createFireHose { my($self, $data) = @_; $data->{dept} ||= ""; @@ -59,6 +59,7 @@ $text_data->{title} = delete $data->{title}; $text_data->{introtext} = delete $data->{introtext}; $text_data->{bodytext} = delete $data->{bodytext}; + $text_data->{media} = delete $data->{media}; $self->sqlDo('SET AUTOCOMMIT=0'); my $ok = $self->sqlInsert("firehose", $data); @@ -156,7 +157,9 @@ tid => $journal->{tid}, srcid => $id, discussion => $journal->{discussion}, - type => $type + type => $type, + ipid => $user->{ipid}, + subnetid => $user->{subnetid}, }; $self->createFireHose($data); if ($publicize && !isAnon($journal->{uid})) { @@ -302,6 +305,7 @@ createtime => $story->{time}, introtext => parseSlashizedLinks($story->{introtext}), bodytext => parseSlashizedLinks($story->{bodytext}), + media => $story->{media}, primaryskid => $story->{primaryskid}, tid => $story->{tid}, public => $public, @@ -309,6 +313,7 @@ discussion => $story->{discussion}, body_length => $story->{body_length}, word_count => $story->{word_count}, + thumb => $story->{thumb}, }; $self->setFireHose($id, $data); @@ -338,6 +343,7 @@ createtime => $story->{time}, introtext => parseSlashizedLinks($story->{introtext}), bodytext => parseSlashizedLinks($story->{bodytext}), + media => $story->{media}, popularity => $popularity, editorpop => $popularity, primaryskid => $story->{primaryskid}, @@ -347,6 +353,7 @@ public => $public, dept => $story->{dept}, discussion => $story->{discussion}, + thumb => $story->{thumb}, }; $self->createFireHose($data); } @@ -1128,6 +1135,7 @@ slashDisplay("formatHoseIntro", { introtext => $introtext, url => $url, $item => $item }, { Return => 1 }); $html->{"text-$_->{id}"} = $introtext; $html->{"fhtime-$_->{id}"} = timeCalc($item->{createtime}); + $html->{"topic-$_->{id}"} = slashDisplay("dispTopicFireHose", { item => $item, adminmode => $adminmode }, { Return => 1}); # updated } } @@ -1461,6 +1469,7 @@ $text_data->{title} = delete $data->{title} if defined $data->{title}; $text_data->{introtext} = delete $data->{introtext} if defined $data->{introtext}; $text_data->{bodytext} = delete $data->{bodytext} if defined $data->{bodytext}; + $text_data->{media} = delete $data->{media} if defined $data->{media}; $self->sqlUpdate('firehose', $data, "id=$id_q"); $self->sqlUpdate('firehose_text', $text_data, "id=$id_q") if keys %$text_data; @@ -2382,6 +2391,13 @@ slashDisplay("firehose_usage", $data, { Return => 1 }); } +sub getNextItemsForThumbnails { + my($self, $lastid, $limit) = @_; + $limit = " LIMIT $limit" if $limit; + $lastid = " AND firehose.id > $lastid" if defined $lastid; + return $self->sqlSelectAllHashrefArray("firehose.id,urls.url", "firehose,urls", "firehose.type='submission' AND firehose.url_id=urls.url_id AND mediatype='video' $lastid", "ORDER BY firehose.id ASC $limit"); +} + 1; __END__ @@ -2393,4 +2409,4 @@ =head1 VERSION -$Id: FireHose.pm,v 1.179 2007/10/25 02:12:17 pudge Exp $ +$Id: FireHose.pm,v 1.182 2007/11/01 20:42:19 tvroom Exp $ Modified: slashjp/branches/upstream/current/plugins/FireHose/PLUGIN =================================================================== --- slashjp/branches/upstream/current/plugins/FireHose/PLUGIN 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/plugins/FireHose/PLUGIN 2007-11-02 07:50:12 UTC (rev 237) @@ -1,4 +1,4 @@ -# $Id: PLUGIN,v 1.25 2007/09/13 18:52:50 tvroom Exp $ +# $Id: PLUGIN,v 1.28 2007/11/02 03:05:49 tvroom Exp $ name=FireHose description="FireHose" css=firehose.css @@ -14,6 +14,7 @@ template=templates/datelaunch;misc;default template=templates/daybreak;firehose;default template=templates/dispFireHose;firehose;default +template=templates/dispTopicFireHose;misc;default template=templates/fhadvprefpane;misc;default template=templates/fireHoseForm;misc;default template=templates/firehose_pages;misc;default @@ -32,5 +33,6 @@ template=templates/tagsfirehosedivuser;misc;default task=firehose_reject_old.pl task=firehose_backend.pl +task=firehose_get_thumbnails.pl image=images/colorscale.png image=images/slidethumb.png Added: slashjp/branches/upstream/current/plugins/FireHose/firehose_get_thumbnails.pl =================================================================== --- slashjp/branches/upstream/current/plugins/FireHose/firehose_get_thumbnails.pl 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/plugins/FireHose/firehose_get_thumbnails.pl 2007-11-02 07:50:12 UTC (rev 237) @@ -0,0 +1,98 @@ +#!/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: firehose_get_thumbnails.pl,v 1.3 2007/11/01 02:01:04 tvroom Exp $ + +use strict; + +use Time::HiRes; + +use Slash; +use Slash::Constants ':slashd'; +use Slash::Display; +use Slash::Utility; +use LWP::Simple; +use URI::Split qw(uri_split); +use File::Type; +use File::Temp; + +use vars qw( + %task $me $task_exit_flag +); + +$task{$me}{timespec} = '0-59/2 * * * *'; +$task{$me}{fork} = SLASHD_NOWAIT; +$task{$me}{code} = sub { + my($virtual_user, $constants, $slashdb, $user, $info, $gSkin) = @_; + my $fh_last = $slashdb->getVar("firehose_last_thumbnail_id", "value", 1); + if (!defined($fh_last)) { + $fh_last = 0; + $slashdb->createVar("firehose_last_thumbnail_id", 0); + } + my $firehose = getObject("Slash::FireHose"); + my $items = $firehose->getNextItemsForThumbnails($fh_last, 10); + + foreach (@$items) { + $fh_last = $_->{id} if $_->{id} > $fh_last; + my $thumb; + my ($scheme, $domain, $path, $query, $frag) = uri_split($_->{url}); + my $page = get $_->{url}; + slashdLog("$_->{id}: $_->{url}\n"); + my @pairs = split(/&/, $query); + my $params = {}; + foreach my $pair (@pairs) { + my ($name, $value) = split(/=/, $pair); + $params->{$name}= $value; + } + if ($page) { + if ($domain =~ /youtube\.com/ && $params->{v}) { + $thumb = "http://img.youtube.com/vi/$params->{v}/0.jpg"; + } elsif ($domain =~ /video.google.com/ && $params->{docid}) { + my $feed = get "http://video.google.com/videofeed?docid=$params->{docid}"; + $feed =~/new(); + my $thumb_data = get $thumb; + my $mimetype = $ft->mime_type($thumb_data); + + if ($mimetype =~ /^image/) { + if (length($thumb_data) < 600000 ) { + my $tmpfile = dataToTmpFile($thumb_data, $thumb); + my $file = { + fhid => $_->{id}, + file => $tmpfile, + action => "thumbnails" + }; + $slashdb->addFileToQueue($file); + } + } + } + } + } + slashdLog("Last id: $fh_last"); + $slashdb->setVar('firehose_last_thumbnail_id', $fh_last); +}; + +sub dataToTmpFile { + my($data, $url) = @_; + my ($suffix) = $url =~ /(\.\w+$)/; + $suffix = lc($suffix); + my ($ofh, $tmpname) = mkstemps("/tmp/upload/fileXXXXXX", $suffix ); + print $ofh $data; + close $ofh; + return $tmpname; +} + +1; + Modified: slashjp/branches/upstream/current/plugins/FireHose/mysql_schema.sql =================================================================== --- slashjp/branches/upstream/current/plugins/FireHose/mysql_schema.sql 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/plugins/FireHose/mysql_schema.sql 2007-11-02 07:50:12 UTC (rev 237) @@ -1,5 +1,5 @@ # -# $Id: mysql_schema.sql,v 1.23 2007/10/23 20:52:13 tvroom Exp $ +# $Id: mysql_schema.sql,v 1.24 2007/10/30 20:18:00 tvroom Exp $ # DROP TABLE IF EXISTS firehose; CREATE TABLE firehose ( @@ -35,6 +35,7 @@ body_length MEDIUMINT UNSIGNED DEFAULT 0 NOT NULL, word_count MEDIUMINT UNSIGNED DEFAULT 0 NOT NULL, srcname VARCHAR(32) NOT NULL DEFAULT '', + thumb MEDIUMINT UNSIGNED, mediatype enum("text", "none", "video", "image", "audio") default "none" NOT NULL, PRIMARY KEY (id), UNIQUE globjid (globjid), @@ -56,6 +57,7 @@ title VARCHAR(80), introtext text, bodytext text, + media text, PRIMARY KEY (id) ) TYPE=InnoDB; Modified: slashjp/branches/upstream/current/plugins/FireHose/templates/dispFireHose;firehose;default =================================================================== --- slashjp/branches/upstream/current/plugins/FireHose/templates/dispFireHose;firehose;default 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/plugins/FireHose/templates/dispFireHose;firehose;default 2007-11-02 07:50:12 UTC (rev 237) @@ -75,21 +75,14 @@ [% IF bodywrapper; Slash.getData('byline', { adminmode => adminmode, item => item, the_user => the_user }, 'firehose'); %] - -

+ [% hasimage = item.tid || (item.thumb && item.type == "story") || (adminmode && item.type == "submission") %] +
[% END %] - [% IF item.tid %] -
+ [% IF hasimage %] +
[% IF bodycontent %] - [% topic = Slash.db.getTopic(item.tid) %] - [% IF user.noicons || user.simpledesign || user.lowbandwidth %] - [ [% topic.textname %] ] - [% ELSIF topic.image %] - - [% topic.textname %] - + [% PROCESS dispTopicFireHose item = item %] [% END %] - [% END %]
[% END %]
@@ -99,6 +92,11 @@ PROCESS formatHoseIntro; END %] [% introtext %] + [% IF item.media %] +
+ [% item.media %] +
+ [% END %]
[% IF bodywrapper %]
@@ -158,4 +156,4 @@ [% END %] [% END %] __version__ -$Id: dispFireHose;firehose;default,v 1.62 2007/09/04 20:53:21 tvroom Exp $ +$Id: dispFireHose;firehose;default,v 1.65 2007/11/01 00:24:42 tvroom Exp $ Added: slashjp/branches/upstream/current/plugins/FireHose/templates/dispTopicFireHose;misc;default =================================================================== --- slashjp/branches/upstream/current/plugins/FireHose/templates/dispTopicFireHose;misc;default 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/plugins/FireHose/templates/dispTopicFireHose;misc;default 2007-11-02 07:50:12 UTC (rev 237) @@ -0,0 +1,39 @@ +__section__ +default +__description__ +You should describe stuff here. +__title__ +Useless title to template +__page__ +misc +__lang__ +en_US +__name__ +dispTopicFireHose +__seclev__ +10000 +__template__ +[% topic = Slash.db.getTopic(item.tid) %] +[% IF (item.thumb && (item.type == "story" || (item.type == "submission" && adminmode))) %] + [% file = Slash.db.getStaticFile(item.thumb); %] + [% link_url = ""; + IF item.type == "story"; + story_link_ar = Slash.linkStory ({ + sid => story.sid, + link => story.title, + tid => story.tid + skin => story.primaryskid + }, 0); + link_url = story_link_ar.0; + ELSE; + link_url = constants.rootdir _ "/firehose.pl?op=view&id=" _ item.id; + END %] + thumbnail + +[% ELSIF user.noicons || user.simpledesign || user.lowbandwidth %] + [ [% topic.textname %] ] +[% ELSIF topic.image %] + + [% topic.textname %] + +[% END %] Modified: slashjp/branches/upstream/current/plugins/FireHose/templates/nodnix_menus;firehose;default =================================================================== --- slashjp/branches/upstream/current/plugins/FireHose/templates/nodnix_menus;firehose;default 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/plugins/FireHose/templates/nodnix_menus;firehose;default 2007-11-02 07:50:12 UTC (rev 237) @@ -1,7 +1,9 @@ __section__ default __description__ -You should describe stuff here. +If the list of these tags is changed, consider also updating the var +'tagbox_top_excludetagnames'. + __title__ Useless title to template __page__ @@ -35,4 +37,4 @@
__version__ -$Id: nodnix_menus;firehose;default,v 1.3 2007/07/18 18:22:21 scc Exp $ +$Id: nodnix_menus;firehose;default,v 1.4 2007/11/01 20:35:18 jamiemccarthy Exp $ Modified: slashjp/branches/upstream/current/plugins/HumanConf/Static/Static.pm =================================================================== --- slashjp/branches/upstream/current/plugins/HumanConf/Static/Static.pm 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/plugins/HumanConf/Static/Static.pm 2007-11-02 07:50:12 UTC (rev 237) @@ -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: Static.pm,v 1.40 2007/10/12 07:23:03 jamiemccarthy Exp $ +# $Id: Static.pm,v 1.41 2007/10/25 17:11:15 jamiemccarthy Exp $ package Slash::HumanConf::Static; @@ -19,7 +19,7 @@ use base 'Slash::DB::Utility'; use base 'Slash::DB::MySQL'; -($VERSION) = ' $Revision: 1.40 $ ' =~ /\$Revision:\s+([^\s]+)/; +($VERSION) = ' $Revision: 1.41 $ ' =~ /\$Revision:\s+([^\s]+)/; sub new { my($class, $user) = @_; @@ -347,7 +347,7 @@ my $constants = getCurrentStatic(); my $filename_mp3 = sprintf("%02d/%s%s", $hcpid % 100, $encoded_name, '.mp3'); my $full_filename_mp3 = "$dir/$filename_mp3"; - my $ssml_text = join('', + my $ssml_text = join(' ', "\u$answer.", map { "\u$_." } split //, $answer); Modified: slashjp/branches/upstream/current/plugins/Journal/Journal.pm =================================================================== --- slashjp/branches/upstream/current/plugins/Journal/Journal.pm 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/plugins/Journal/Journal.pm 2007-11-02 07:50:12 UTC (rev 237) @@ -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: Journal.pm,v 1.67 2007/10/26 03:05:27 pudge Exp $ +# $Id: Journal.pm,v 1.68 2007/11/01 20:35:18 jamiemccarthy Exp $ package Slash::Journal; @@ -16,7 +16,7 @@ use base 'Slash::DB::Utility'; use base 'Slash::DB::MySQL'; -($VERSION) = ' $Revision: 1.67 $ ' =~ /\$Revision:\s+([^\s]+)/; +($VERSION) = ' $Revision: 1.68 $ ' =~ /\$Revision:\s+([^\s]+)/; # On a side note, I am not sure if I liked the way I named the methods either. # -Brian @@ -192,14 +192,16 @@ my $constants = getCurrentStatic(); - my $uid = getCurrentUser('uid'); + my $user = getCurrentUser(); $self->sqlInsert("journals", { - uid => $uid, + uid => $user->{uid}, description => $description, tid => $tid, - -date => 'now()', + -date => 'NOW()', posttype => $posttype, - promotetype => $promotetype + promotetype => $promotetype, + srcid_24 => get_srcid_sql_in($user->{srcids}{24}), + srcid_32 => get_srcid_sql_in($user->{srcids}{32}), }); my($id) = $self->getLastInsertId({ table => 'journals', prime => 'id' }); @@ -212,7 +214,7 @@ my($date) = $self->sqlSelect('date', 'journals', "id=$id"); my $slashdb = getCurrentDB(); - $slashdb->setUser($uid, { journal_last_entry_date => $date }); + $slashdb->setUser($user->{uid}, { journal_last_entry_date => $date }); if ($constants->{plugin}{FireHose}) { my $reskey = getObject('Slash::ResKey'); my $rkey = $reskey->key('submit', { nostate => 1 }); Modified: slashjp/branches/upstream/current/plugins/Journal/mysql_schema =================================================================== --- slashjp/branches/upstream/current/plugins/Journal/mysql_schema 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/plugins/Journal/mysql_schema 2007-11-02 07:50:12 UTC (rev 237) @@ -1,5 +1,5 @@ # -# $Id: mysql_schema,v 1.16 2006/12/12 22:46:45 tvroom Exp $ +# $Id: mysql_schema,v 1.17 2007/11/01 20:35:18 jamiemccarthy Exp $ # DROP TABLE IF EXISTS journals; @@ -13,10 +13,14 @@ tid SMALLINT UNSIGNED NOT NULL, promotetype ENUM ("publicize","publish", "post") NOT NULL DEFAULT "publish", last_update timestamp NOT NULL, + srcid_32 BIGINT UNSIGNED NOT NULL DEFAULT 0, + srcid_24 BIGINT UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY (id), KEY uid_date_id (uid,date,id), KEY IDandUID (id,uid), - KEY tid (tid) + KEY tid (tid), + KEY srcid_32 (srcid_32), + KEY srcid_24 (srcid_24) ); DROP TABLE IF EXISTS journals_text; Modified: slashjp/branches/upstream/current/plugins/Login/login.pl =================================================================== --- slashjp/branches/upstream/current/plugins/Login/login.pl 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/plugins/Login/login.pl 2007-11-02 07:50:12 UTC (rev 237) @@ -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: login.pl,v 1.28 2007/10/16 22:31:22 pudge Exp $ +# $Id: login.pl,v 1.29 2007/11/01 20:35:18 jamiemccarthy Exp $ use strict; use Slash 2.003; @@ -12,7 +12,7 @@ use Slash::XML; use vars qw($VERSION); -($VERSION) = ' $Revision: 1.28 $ ' =~ /\$Revision:\s+([^\s]+)/; +($VERSION) = ' $Revision: 1.29 $ ' =~ /\$Revision:\s+([^\s]+)/; sub main { my $slashdb = getCurrentDB(); @@ -228,9 +228,7 @@ @srcids{keys %{$user->{srcids}}} = values %{$user->{srcids}}; delete $srcids{uid}; - if ($reader->checkAL2(\%srcids, 'nopost') - || $reader->checkAL2(\%srcids, 'nopostanon') - ) { + if ($reader->checkAL2(\%srcids, [qw( nopost nopostanon spammer )])) { push @note, getData('mail_readonly'); $error = 1; Modified: slashjp/branches/upstream/current/plugins/Metamod/templates/dispTheComments;metamod;default =================================================================== --- slashjp/branches/upstream/current/plugins/Metamod/templates/dispTheComments;metamod;default 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/plugins/Metamod/templates/dispTheComments;metamod;default 2007-11-02 07:50:12 UTC (rev 237) @@ -21,8 +21,8 @@ [% STOP %] [% END %] [% user.noscores = 1; # Do not show scores in comment display. %] -PLEASE READ THE DIRECTIONS CAREFULLY BEFORE EMAILING -[% constants.siteadmin_name.uc %]!

What follows are random +PLEASE READ THE DIRECTIONS CAREFULLY BEFORE EMAILING US! +

What follows are random moderations performed on comments in the last few weeks on [% constants.sitename %]. You are asked to honestly evaluate the actions of the moderator of each comment. Moderators who are ranked poorly will cease to be eligible for @@ -86,4 +86,4 @@ __seclev__ 1000 __version__ -$Id: dispTheComments;metamod;default,v 1.1 2006/09/03 15:46:00 jamiemccarthy Exp $ +$Id: dispTheComments;metamod;default,v 1.2 2007/11/01 20:32:02 jamiemccarthy Exp $ Added: slashjp/branches/upstream/current/plugins/ResKey/ResKey/Checks/AL2/Spammer.pm =================================================================== --- slashjp/branches/upstream/current/plugins/ResKey/ResKey/Checks/AL2/Spammer.pm 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/plugins/ResKey/ResKey/Checks/AL2/Spammer.pm 2007-11-02 07:50:12 UTC (rev 237) @@ -0,0 +1,24 @@ +# 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: Spammer.pm,v 1.1 2007/11/01 20:35:19 jamiemccarthy Exp $ + +package Slash::ResKey::Checks::AL2::Spammer; + +use warnings; +use strict; + +use Slash::ResKey::Checks::AL2; +use Slash::Utility; +use Slash::Constants ':reskey'; + +use base 'Slash::ResKey::Key'; + +our($VERSION) = ' $Revision: 1.1 $ ' =~ /\$Revision:\s+([^\s]+)/; + +sub doCheck { + my($self) = @_; + return AL2Check($self, 'spammer'); +} + +1; Modified: slashjp/branches/upstream/current/plugins/ResKey/mysql_dump.sql =================================================================== --- slashjp/branches/upstream/current/plugins/ResKey/mysql_dump.sql 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/plugins/ResKey/mysql_dump.sql 2007-11-02 07:50:12 UTC (rev 237) @@ -1,5 +1,5 @@ # -# $Id: mysql_dump.sql,v 1.19 2007/08/29 06:26:44 pudge Exp $ +# $Id: mysql_dump.sql,v 1.20 2007/11/01 20:35:19 jamiemccarthy Exp $ # ### NOTE: reserved reskey IDs: @@ -52,6 +52,7 @@ 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); INSERT INTO reskey_resource_checks VALUES (NULL, 1, 'use', 'Slash::ResKey::Checks::ProxyScan', 1001); @@ -78,6 +79,7 @@ INSERT INTO reskey_resource_checks VALUES (NULL, 2, 'all', 'Slash::ResKey::Checks::AL2::AnonNoPost', 301); INSERT INTO reskey_resource_checks VALUES (NULL, 2, 'all', 'Slash::ResKey::Checks::AL2::NoPostAnon', 401); INSERT INTO reskey_resource_checks VALUES (NULL, 2, 'all', 'Slash::ResKey::Checks::AL2::NoPost', 501); +INSERT INTO reskey_resource_checks VALUES (NULL, 2, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); INSERT INTO reskey_resource_checks VALUES (NULL, 2, 'all', 'Slash::ResKey::Checks::Duration', 601); ### vars @@ -101,6 +103,7 @@ INSERT INTO reskey_resource_checks VALUES (NULL, 3, 'all', 'Slash::ResKey::Checks::AL2::AnonNoPost', 301); INSERT INTO reskey_resource_checks VALUES (NULL, 3, 'all', 'Slash::ResKey::Checks::AL2::NoPostAnon', 401); INSERT INTO reskey_resource_checks VALUES (NULL, 3, 'all', 'Slash::ResKey::Checks::AL2::NoPost', 501); +INSERT INTO reskey_resource_checks VALUES (NULL, 3, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); INSERT INTO reskey_resource_checks VALUES (NULL, 3, 'all', 'Slash::ResKey::Checks::Duration', 601); ### vars @@ -120,6 +123,7 @@ INSERT INTO reskey_resource_checks VALUES (NULL, 4, 'all', 'Slash::ResKey::Checks::AL2::AnonNoPost', 301); INSERT INTO reskey_resource_checks VALUES (NULL, 4, 'all', 'Slash::ResKey::Checks::AL2::NoPostAnon', 401); INSERT INTO reskey_resource_checks VALUES (NULL, 4, 'all', 'Slash::ResKey::Checks::AL2::NoPost', 501); +INSERT INTO reskey_resource_checks VALUES (NULL, 4, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); INSERT INTO reskey_resource_checks VALUES (NULL, 4, 'all', 'Slash::ResKey::Checks::Duration', 601); ### vars @@ -157,6 +161,7 @@ INSERT INTO reskey_resource_checks VALUES (NULL, 5, 'all', 'Slash::ResKey::Checks::AL2::AnonNoPost', 301); INSERT INTO reskey_resource_checks VALUES (NULL, 5, 'all', 'Slash::ResKey::Checks::AL2::NoPostAnon', 401); INSERT INTO reskey_resource_checks VALUES (NULL, 5, 'all', 'Slash::ResKey::Checks::AL2::NoPost', 501); +INSERT INTO reskey_resource_checks VALUES (NULL, 5, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); INSERT INTO reskey_resource_checks VALUES (NULL, 5, 'all', 'Slash::ResKey::Checks::Duration', 601); ### vars @@ -177,6 +182,7 @@ INSERT INTO reskey_resource_checks VALUES (NULL, 6, 'all', 'Slash::ResKey::Checks::AL2::AnonNoPost', 301); INSERT INTO reskey_resource_checks VALUES (NULL, 6, 'all', 'Slash::ResKey::Checks::AL2::NoPostAnon', 401); INSERT INTO reskey_resource_checks VALUES (NULL, 6, 'all', 'Slash::ResKey::Checks::AL2::NoPost', 501); +INSERT INTO reskey_resource_checks VALUES (NULL, 6, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); INSERT INTO reskey_resource_checks VALUES (NULL, 6, 'all', 'Slash::ResKey::Checks::AL2::NoSubmit', 551); INSERT INTO reskey_resource_checks VALUES (NULL, 6, 'all', 'Slash::ResKey::Checks::Duration', 601); @@ -198,6 +204,7 @@ INSERT INTO reskey_resource_checks VALUES (NULL, 9, 'all', 'Slash::ResKey::Checks::AL2::AnonNoPost', 301); INSERT INTO reskey_resource_checks VALUES (NULL, 9, 'all', 'Slash::ResKey::Checks::AL2::NoPostAnon', 401); INSERT INTO reskey_resource_checks VALUES (NULL, 9, 'all', 'Slash::ResKey::Checks::AL2::NoPost', 501); +INSERT INTO reskey_resource_checks VALUES (NULL, 9, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); INSERT INTO reskey_resource_checks VALUES (NULL, 9, 'use', 'Slash::ResKey::Checks::Moderate', 601); ### vars @@ -219,7 +226,7 @@ INSERT INTO reskey_resource_checks VALUES (NULL, 10, 'all', 'Slash::ResKey::Checks::ACL', 201); INSERT INTO reskey_resource_checks VALUES (NULL, 10, 'all', 'Slash::ResKey::Checks::AL2::AnonNoPost', 301); INSERT INTO reskey_resource_checks VALUES (NULL, 10, 'all', 'Slash::ResKey::Checks::AL2::NoPostAnon', 401); -INSERT INTO reskey_resource_checks VALUES (NULL, 10, 'all', 'Slash::ResKey::Checks::AL2::NoPost', 501); +INSERT INTO reskey_resource_checks VALUES (NULL, 10, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); INSERT INTO reskey_resource_checks VALUES (NULL, 10, 'all', 'Slash::ResKey::Checks::AL2::NoSubmit', 551); INSERT INTO reskey_resource_checks VALUES (NULL, 10, 'all', 'Slash::ResKey::Checks::Duration', 601); Modified: slashjp/branches/upstream/current/plugins/Tags/Tags.pm =================================================================== --- slashjp/branches/upstream/current/plugins/Tags/Tags.pm 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/plugins/Tags/Tags.pm 2007-11-02 07:50:12 UTC (rev 237) @@ -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.85 2007/10/24 21:12:23 jamiemccarthy Exp $ +# $Id: Tags.pm,v 1.86 2007/10/25 15:39:07 jamiemccarthy Exp $ package Slash::Tags; @@ -11,13 +11,13 @@ use Slash::Display; use Slash::Utility; use Slash::DB::Utility; -use Slash::Clout; +#use Slash::Clout; use Apache::Cookie; use vars qw($VERSION); use base 'Slash::DB::Utility'; use base 'Slash::DB::MySQL'; -($VERSION) = ' $Revision: 1.85 $ ' =~ /\$Revision:\s+([^\s]+)/; +($VERSION) = ' $Revision: 1.86 $ ' =~ /\$Revision:\s+([^\s]+)/; # FRY: And where would a giant nerd be? THE LIBRARY! Modified: slashjp/branches/upstream/current/plugins/Tags/templates/tagsstorydivadmin;misc;default =================================================================== --- slashjp/branches/upstream/current/plugins/Tags/templates/tagsstorydivadmin;misc;default 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/plugins/Tags/templates/tagsstorydivadmin;misc;default 2007-11-02 07:50:12 UTC (rev 237) @@ -16,7 +16,7 @@ [% IF user.is_admin %] [% PROCESS ajax_reskey_tag reskey_label => 'admin_commands-reskey-' _ sidenc, reskey_name => 'ajax_admin' %] - + [History]

[% tags_admin_str %]
@@ -26,4 +26,4 @@ __seclev__ 10000 __version__ -$Id: tagsstorydivadmin;misc;default,v 1.10 2007/10/24 00:30:08 scc Exp $ +$Id: tagsstorydivadmin;misc;default,v 1.11 2007/10/25 15:39:07 jamiemccarthy Exp $ Modified: slashjp/branches/upstream/current/plugins/Tags/templates/tagsurldivadmin;misc;default =================================================================== --- slashjp/branches/upstream/current/plugins/Tags/templates/tagsurldivadmin;misc;default 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/plugins/Tags/templates/tagsurldivadmin;misc;default 2007-11-02 07:50:12 UTC (rev 237) @@ -16,7 +16,7 @@ [% IF user.is_admin %] [% PROCESS ajax_reskey_tag reskey_label => 'admin_commands-reskey-' _ id, reskey_name => 'ajax_admin' %] - + [History]
[% tags_admin_str %]
@@ -26,4 +26,4 @@ __seclev__ 10000 __version__ -$Id: tagsurldivadmin;misc;default,v 1.2 2007/10/24 00:30:08 scc Exp $ +$Id: tagsurldivadmin;misc;default,v 1.3 2007/10/25 15:39:07 jamiemccarthy Exp $ Modified: slashjp/branches/upstream/current/sql/mysql/defaults.sql =================================================================== --- slashjp/branches/upstream/current/sql/mysql/defaults.sql 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/sql/mysql/defaults.sql 2007-11-02 07:50:12 UTC (rev 237) @@ -3,7 +3,7 @@ #-------------------------------------------------------- # Server version 3.23.26-beta-log # -# $Id: defaults.sql,v 1.374 2007/10/25 07:13:04 pudge Exp $ +# $Id: defaults.sql,v 1.376 2007/11/02 00:30:01 pudge Exp $ # # @@ -25,6 +25,7 @@ INSERT INTO al2_types VALUES (8, 6, 'trusted', 'Trusted'); INSERT INTO al2_types VALUES (9, 7, 'proxy', 'Valid Proxy'); INSERT INTO al2_types VALUES (10, 8, 'nopostanon', 'No Comment Post Anon'); +INSERT INTO al2_types VALUES (11, 9, 'binspam', 'Binspammer'); # @@ -830,7 +831,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_181','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_182','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/slashschema_create.sql =================================================================== --- slashjp/branches/upstream/current/sql/mysql/slashschema_create.sql 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/sql/mysql/slashschema_create.sql 2007-11-02 07:50:12 UTC (rev 237) @@ -4,7 +4,7 @@ #-------------------------------------------------------- # Server version 3.23.26-beta # -# $Id: slashschema_create.sql,v 1.254 2007/10/23 23:20:15 pudge Exp $ +# $Id: slashschema_create.sql,v 1.255 2007/10/30 20:30:08 tvroom Exp $ # # @@ -1065,13 +1065,14 @@ # -# Table structure for table 'story_static_files' +# Table structure for table 'static_files' # -DROP TABLE IF EXISTS story_static_files; +DROP TABLE IF EXISTS static_files; CREATE TABLE story_static_files( sfid mediumint unsigned NOT NULL auto_increment, stoid mediumint unsigned NOT NULL, + fhid mediumint unsigned NOT NULL, filetype ENUM("file", "image", "audio") not null default "file", name varchar(255) default '' NOT NULL, width smallint unsigned not null default 0, Modified: slashjp/branches/upstream/current/sql/mysql/upgrades =================================================================== --- slashjp/branches/upstream/current/sql/mysql/upgrades 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/sql/mysql/upgrades 2007-11-02 07:50:12 UTC (rev 237) @@ -10,7 +10,7 @@ # after X started at the same time that X was tagged. # -# $Id: upgrades,v 1.1266 2007/10/26 03:05:27 pudge Exp $ +# $Id: upgrades,v 1.1271 2007/11/02 03:35:13 pudge Exp $ # # BEGIN tf23's additions @@ -4916,17 +4916,16 @@ # For tagboxes/Top INSERT INTO tagbox_userkeyregexes VALUES ('Top', '^tag_clout$'); - CREATE TABLE file_queue ( fqid int(10) unsigned NOT NULL auto_increment, stoid mediumint(8) unsigned default NULL, fhid mediumint(8) unsigned default NULL, file varchar(255) default NULL, action enum('upload','thumbnails') default NULL, - PRIMARY KEY (fqid) + PRIMARY KEY (fqid) ) ENGINE=InnoDB; -CREATE TABLE story_static_files( +CREATE TABLE story_static_files ( sfid mediumint unsigned NOT NULL auto_increment, stoid mediumint unsigned NOT NULL, filetype ENUM("file", "image", "audio") not null default "file", @@ -4935,12 +4934,9 @@ INDEX stoid(stoid) ) ENGINE=InnoDB; - # 2007-10-16 UPDATE vars SET value = 'T_2_5_0_180' WHERE name = 'cvs_tag_currentcode'; -# SLASHDOT LAST UPDATED HERE - INSERT INTO string_param (type, code, name) VALUES ('mediatypes','none','None'); INSERT INTO string_param (type, code, name) VALUES ('mediatypes','video','Video'); INSERT INTO string_param (type, code, name) VALUES ('mediatypes','image','Image'); @@ -4964,7 +4960,45 @@ # 2007-10-25 UPDATE vars SET value = 'T_2_5_0_181' WHERE name = 'cvs_tag_currentcode'; +# PUDGE LAST UPDATED HERE + +# For plugins/FireHose +# Install CPAN module File::Type for plugins/FireHose +ALTER TABLE firehose_text ADD COLUMN media TEXT; +ALTER TABLE firehose ADD thumb MEDIUMINT UNSIGNED; + +RENAME TABLES story_static_files to static_files; +ALTER TABLE static_files ADD COLUMN fhid mediumint unsigned NOT NULL; + +# for plugins/Journal +ALTER TABLE journals ADD COLUMN srcid_32 BIGINT UNSIGNED NOT NULL DEFAULT 0, ADD COLUMN srcid_24 BIGINT UNSIGNED NOT NULL DEFAULT 0; +ALTER TABLE journals ADD INDEX srcid_32 (srcid_32), ADD INDEX srcid_24 (srcid_24); + +# for plugins/Bookmark +ALTER TABLE bookmarks ADD COLUMN srcid_32 BIGINT UNSIGNED NOT NULL DEFAULT 0, ADD COLUMN srcid_24 BIGINT UNSIGNED NOT NULL DEFAULT 0; +ALTER TABLE bookmarks ADD INDEX srcid_32 (srcid_32), ADD INDEX srcid_24 (srcid_24); +INSERT INTO reskey_resource_checks VALUES (NULL, 8, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); + +SELECT @maxbitpos := MAX(bitpos) FROM al2_types; +INSERT INTO al2_types VALUES (NULL, @maxbitpos+1, 'spammer', 'Spammer'); + +INSERT INTO reskey_resource_checks VALUES (NULL, 1, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); +INSERT INTO reskey_resource_checks VALUES (NULL, 2, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); +INSERT INTO reskey_resource_checks VALUES (NULL, 3, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); +INSERT INTO reskey_resource_checks VALUES (NULL, 4, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); +INSERT INTO reskey_resource_checks VALUES (NULL, 5, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); +INSERT INTO reskey_resource_checks VALUES (NULL, 6, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); +INSERT INTO reskey_resource_checks VALUES (NULL, 9, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); +INSERT INTO reskey_resource_checks VALUES (NULL,10, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); + +# For tagboxes/Top +INSERT IGNORE INTO vars (name, value, description) VALUES ('tagbox_top_excludetagnames', 'yes no binspam dupe notthebest offtopic stupid slownewsday interesting funny insightful', 'Minimum score a tag must have to make it into the top tags for a story or firehose item'); + + +# 2007-11-01 +UPDATE vars SET value = 'T_2_5_0_182' WHERE name = 'cvs_tag_currentcode'; + # SLASHCODE/USEPERL LAST UPDATED HERE -# PUDGE LAST UPDATED HERE +# SLASHDOT LAST UPDATED HERE Added: slashjp/branches/upstream/current/tagboxes/Despam/Despam.pm =================================================================== --- slashjp/branches/upstream/current/tagboxes/Despam/Despam.pm 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/tagboxes/Despam/Despam.pm 2007-11-02 07:50:12 UTC (rev 237) @@ -0,0 +1,264 @@ +#!/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: Despam.pm,v 1.1 2007/11/01 20:35:18 jamiemccarthy Exp $ + +package Slash::Tagbox::Despam; + +=head1 NAME + +Slash::Tagbox::Despam - Reduce (firehose) spam + +=head1 SYNOPSIS + + my $tagbox_tcu = getObject("Slash::Tagbox::Despam"); + my $feederlog_ar = $tagbox_tcu->feed_newtags($users_ar); + $tagbox_tcu->run($affected_globjid); + +=cut + +use strict; + +use Slash; +use Slash::DB; +use Slash::Utility::Environment; +use Slash::Tagbox; + +use Data::Dumper; + +use vars qw( $VERSION ); +$VERSION = ' $Revision: 1.1 $ ' =~ /\$Revision:\s+([^\s]+)/; + +use base 'Slash::DB::Utility'; # first for object init stuff, but really + # needs to be second! figure it out. -- pudge +use base 'Slash::DB::MySQL'; + +sub new { + my($class, $user) = @_; + + return undef if !$class->isInstalled(); + + # Note that getTagboxes() would call back to this new() function + # if the tagbox objects have not yet been created -- but the + # no_objects option prevents that. See getTagboxes() for details. + my($tagbox_name) = $class =~ /(\w+)$/; + my %self_hash = %{ getObject('Slash::Tagbox')->getTagboxes($tagbox_name, undef, { no_objects => 1 }) }; + my $self = \%self_hash; + return undef if !$self || !keys %$self; + + bless($self, $class); + $self->{virtual_user} = $user; + $self->sqlConnect(); + + my $constants = getCurrentStatic(); + my $tagsdb = getObject('Slash::Tags'); + $self->{spamid} = $tagsdb->getTagnameidCreate('binspam'); + $self->{upvoteid} = $tagsdb->getTagnameidCreate($constants->{tags_upvote_tagname} || 'nod'); + return undef unless $self->{spamid}; + + return $self; +} + +sub isInstalled { + my($class) = @_; + my $constants = getCurrentStatic(); + my($tagbox_name) = $class =~ /(\w+)$/; + return $constants->{plugin}{Tags} && $constants->{tagbox}{$tagbox_name} || 0; +} + +sub feed_newtags { + my($self, $tags_ar) = @_; + my $constants = getCurrentStatic(); + if (scalar(@$tags_ar) < 9) { + main::tagboxLog("Despam->feed_newtags called for tags '" . join(' ', map { $_->{tagid} } @$tags_ar) . "'"); + } else { + main::tagboxLog("Despam->feed_newtags called for " . scalar(@$tags_ar) . " tags " . $tags_ar->[0]{tagid} . " ... " . $tags_ar->[-1]{tagid}); + } + + # The algorithm of the importance of tags to this tagbox is simple + # (at least for now). 'binspam' from an admin on a firehose item + # is important. Other tags are not. + my $slashdb = getCurrentDB(); + my $admins = $slashdb->getAdmins(); + + my $ret_ar = [ ]; + for my $tag_hr (@$tags_ar) { + next unless $tag_hr->{tagnameid} == $self->{spamid} && $admins->{ $tag_hr->{uid} }; + my $ret_hr = { + affected_id => $tag_hr->{globjid}, + importance => 1, + }; + # We identify this little chunk of importance by either + # tagid or tdid depending on whether the source data had + # the tdid field (which tells us whether feed_newtags was + # "really" called via feed_deactivatedtags). + if ($tag_hr->{tdid}) { $ret_hr->{tdid} = $tag_hr->{tdid} } + else { $ret_hr->{tagid} = $tag_hr->{tagid} } + push @$ret_ar, $ret_hr; + } + return [ ] if !@$ret_ar; + + # Tags applied to globjs that have a firehose entry associated + # are important. Other tags are not. + my %globjs = ( map { $_->{affected_id}, 1 } @$ret_ar ); + my $globjs_str = join(', ', sort keys %globjs); + my $fh_globjs_ar = $self->sqlSelectColArrayref( + 'globjid', + 'firehose', + "globjid IN ($globjs_str)"); + 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 ]; + + main::tagboxLog("Despam->feed_newtags returning " . scalar(@$ret_ar)); + return $ret_ar; +} + +sub feed_deactivatedtags { + my($self, $tags_ar) = @_; + main::tagboxLog("Despam->feed_deactivatedtags called: tags_ar='" . join(' ', map { $_->{tagid} } @$tags_ar) . "'"); + my $ret_ar = $self->feed_newtags($tags_ar); + main::tagboxLog("Despam->feed_deactivatedtags returning " . scalar(@$ret_ar)); + return $ret_ar; +} + +sub feed_userchanges { + my($self, $users_ar) = @_; + main::tagboxLog("Despam->feed_userchanges called (oddly): users_ar='" . join(' ', map { $_->{tuid} } @$users_ar) . "'"); + return [ ]; +} + +sub run { + my($self, $affected_id, $options) = @_; + my $constants = getCurrentStatic(); + my $tagsdb = getObject('Slash::Tags'); + my $tagboxdb = getObject('Slash::Tagbox'); + my $firehose_db = getObject('Slash::FireHose'); + + 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 $fhitem = $firehose_db->getFireHose($fhid); + my $submitter_uid = $fhitem->{uid}; + + my $admins = $tagsdb->getAdmins(); + my $admin_in_str = join(',', + sort { $a <=> $b } + grep { $admins->{$_}{seclev} >= 100 } + keys %$admins); + return unless $admin_in_str; + + my $slashdb = getCurrentStatic(); + 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"); + if ($binspam_count > $constants->{tagbox_despam_binspamsallowed}) { + main::tagboxLog(sprintf("%s->run marking uid %d for %d admin binspam tags, latest %d (%d)", + ref($self), $submitter_uid, $binspam_count, $fhid, $affected_id)); + $self->despam_uid($submitter_uid, $binspam_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. + $slashdb->setAL2($uid, { spammer => 1, comment => "Despam $count" }); + + # Next, set the user's clout manually to 0. + $slashdb->setUser($uid, { tag_clout => 0 }); + + # Next, if $count is high enough, set the 'spammer' AL2 for all + # the IPID's the user has submitted from. + 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)"); + my $journal_srcid_ar = $reader->sqlSelectColArrayref( + 'DISTINCT ' . get_srcid_sql_out('srcid_32'), + 'journals', + "uid=$uid AND date >= DATE_SUB(NOW(), INTERVAL $days DAY)"); + my $book_srcid_ar = $reader->sqlSelectColArrayref( + 'DISTINCT ' . get_srcid_sql_out('srcid_32'), + 'bookmarks', + "uid=$uid AND time >= DATE_SUB(NOW(), INTERVAL $days DAY)"); + 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 keys %srcid_used; + for my $srcid (@srcids) { + $slashdb->setAL2($srcid, { spammer => 1, comment => "Despam $count" }); + } + } + + # Next, reject everything the user's submitted. + $slashdb->sqlUpdate('firehose', { rejected => 'yes' }, + "accepted != 'no' AND uid=$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}"); + my $max_clout = defined($constants->{tagbox_despam_upvotermaxclout}) + ? $constants->{tagbox_despam_upvotermaxclout} : '0.85'; + for my $upvoter (@$upvoter_ar) { +print STDERR "Despam setting user $upvoter clout to $max_clout\n"; + $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 }, + }); + } + } + sleep 10; +} + +1; + Added: slashjp/branches/upstream/current/tagboxes/Despam/Makefile.PL =================================================================== --- slashjp/branches/upstream/current/tagboxes/Despam/Makefile.PL 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/tagboxes/Despam/Makefile.PL 2007-11-02 07:50:12 UTC (rev 237) @@ -0,0 +1,9 @@ +use ExtUtils::MakeMaker; +# See lib/ExtUtils/MakeMaker.pm for details of how to influence +# the contents of the Makefile that is written. +# $Id: Makefile.PL,v 1.1 2007/11/01 20:35:18 jamiemccarthy Exp $ +WriteMakefile( + 'NAME' => 'Slash::Tagbox::Despam', + 'VERSION_FROM' => 'Despam.pm', # finds $VERSION + 'PM' => { 'Despam.pm' => '$(INST_LIBDIR)/Despam.pm' }, +); Added: slashjp/branches/upstream/current/tagboxes/Despam/TAGBOX =================================================================== --- slashjp/branches/upstream/current/tagboxes/Despam/TAGBOX 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/tagboxes/Despam/TAGBOX 2007-11-02 07:50:12 UTC (rev 237) @@ -0,0 +1,4 @@ +# $Id: TAGBOX,v 1.1 2007/11/01 20:35:18 jamiemccarthy Exp $ +name=Despam +description=Reduce (firehose) spam +mysql_dump=mysql_dump.sql Added: slashjp/branches/upstream/current/tagboxes/Despam/mysql_dump.sql =================================================================== --- slashjp/branches/upstream/current/tagboxes/Despam/mysql_dump.sql 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/tagboxes/Despam/mysql_dump.sql 2007-11-02 07:50:12 UTC (rev 237) @@ -0,0 +1,5 @@ +# $Id: mysql_dump.sql,v 1.1 2007/11/01 20:35:18 jamiemccarthy Exp $ +INSERT INTO tagboxes (tbid, name, affected_type, clid, weight, last_run_completed, last_tagid_logged, last_tdid_logged, last_tuid_logged) VALUES (NULL, 'Despam', 'globj', 1, 1, '2000-01-01 00:00:00', 0, 0, 0); +INSERT IGNORE INTO vars (name, value, description) VALUES ('tagbox_despam_binspamsallowed', '1', 'Number of binspam tags allowed before action is taken'); +INSERT IGNORE INTO vars (name, value, description) VALUES ('tagbox_despam_ipdayslookback', '60', 'Number of days to look back in tables to mark IPs, 0 disables IP marking'); +INSERT IGNORE INTO vars (name, value, description) VALUES ('tagbox_despam_upvotermaxclout', '0.85', 'Maximum tag_clout for any user who upvotes a submission from a spammer user'); Modified: slashjp/branches/upstream/current/tagboxes/Top/Top.pm =================================================================== --- slashjp/branches/upstream/current/tagboxes/Top/Top.pm 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/tagboxes/Top/Top.pm 2007-11-02 07:50:12 UTC (rev 237) @@ -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: Top.pm,v 1.13 2007/10/18 03:02:50 jamiemccarthy Exp $ +# $Id: Top.pm,v 1.14 2007/11/01 20:35:19 jamiemccarthy Exp $ package Slash::Tagbox::Top; @@ -28,7 +28,7 @@ use Data::Dumper; use vars qw( $VERSION ); -$VERSION = ' $Revision: 1.13 $ ' =~ /\$Revision:\s+([^\s]+)/; +$VERSION = ' $Revision: 1.14 $ ' =~ /\$Revision:\s+([^\s]+)/; use base 'Slash::DB::Utility'; # first for object init stuff, but really # needs to be second! figure it out. -- pudge @@ -200,6 +200,16 @@ $a cmp $b } keys %scores; + # Eliminate tagnames in a given list, and their opposites. + my %nontop = ( map { ($_, 1) } + grep { $_ } + map { ($_, $tags_reader->getOppositeTagname($_)) } + split / /, ($constants->{tagbox_top_excludetagnames} || '') + ); + # Eliminate tagnames that are just the author's name. + my @names = map { lc } @{ $tags_reader->getAuthorNames() }; + for my $name (@names) { $nontop{$name} = 1 } + # Eliminate tagnames below the minimum score required, and # those that didn't make it to the top 5 # XXX the "4" below (aka "top 5") is hardcoded currently, should be a var @@ -212,7 +222,8 @@ my $fhid = $firehose->getFireHoseIdFromGlobjid($affected_id); my @top = ( ); if ($fhid) { - @top = grep { $scores{$_} >= $minscore1 } + @top = grep { $scores{$_} >= $minscore1 } + grep { !$nontop{$_} } sort { $scores{$b} <=> $scores{$a} || @@ -227,6 +238,7 @@ if ($type eq 'stories') { my @top = grep { $scores{$_} >= $minscore2 } + grep { !$nontop{$_} } sort { $scores{$b} <=> $scores{$a} || Modified: slashjp/branches/upstream/current/tagboxes/Top/mysql_dump.sql =================================================================== --- slashjp/branches/upstream/current/tagboxes/Top/mysql_dump.sql 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/tagboxes/Top/mysql_dump.sql 2007-11-02 07:50:12 UTC (rev 237) @@ -1,9 +1,10 @@ -# $Id: mysql_dump.sql,v 1.3 2007/10/13 11:52:33 jamiemccarthy Exp $ +# $Id: mysql_dump.sql,v 1.4 2007/11/01 20:35:19 jamiemccarthy Exp $ INSERT INTO tagboxes (tbid, name, affected_type, clid, weight, last_run_completed, last_tagid_logged, last_tdid_logged, last_tuid_logged) VALUES (NULL, 'Top', 'globj', 1, 1, '2000-01-01 00:00:00', 0, 0, 0); INSERT INTO tagbox_userkeyregexes VALUES ('Top', '^tag_clout$'); INSERT IGNORE INTO vars (name, value, description) VALUES ('tagbox_top_minscore_stories', '2', 'Minimum score a tag must have to make it into the top tags for a story'); INSERT IGNORE INTO vars (name, value, description) VALUES ('tagbox_top_minscore_urls', '2', 'Minimum score a tag must have to make it into the top tags for a URL'); +INSERT IGNORE INTO vars (name, value, description) VALUES ('tagbox_top_excludetagnames', 'yes no binspam dupe notthebest offtopic stupid slownewsday interesting funny insightful', 'Minimum score a tag must have to make it into the top tags for a story or firehose item'); INSERT INTO tagbox_userkeyregexes VALUES ('Top', '^tag_clout$'); Modified: slashjp/branches/upstream/current/themes/slashcode/htdocs/comments.css =================================================================== --- slashjp/branches/upstream/current/themes/slashcode/htdocs/comments.css 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/themes/slashcode/htdocs/comments.css 2007-11-02 07:50:12 UTC (rev 237) @@ -144,10 +144,6 @@ } .newcomment { } -.currcomment { - opacity: .50; - filter: alpha(opacity=50); -} .comment > .hidden { display: none; @@ -171,6 +167,10 @@ overflow: hidden; } +.comment > .currcomment { + border: 1px dotted #666; +} + /* lots of space between lines */ .comment > .oneline .commentTop, .comment > .oneline .commentBody { border: none; Modified: slashjp/branches/upstream/current/themes/slashcode/htdocs/images/comments.js =================================================================== (Binary files differ) Modified: slashjp/branches/upstream/current/themes/slashcode/htdocs/users.pl =================================================================== --- slashjp/branches/upstream/current/themes/slashcode/htdocs/users.pl 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/themes/slashcode/htdocs/users.pl 2007-11-02 07:50:12 UTC (rev 237) @@ -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: users.pl,v 1.340 2007/10/16 22:31:24 pudge Exp $ +# $Id: users.pl,v 1.341 2007/11/01 20:35:18 jamiemccarthy Exp $ use strict; use Digest::MD5 'md5_hex'; @@ -696,10 +696,11 @@ # user, to determine whether this IP is OK'd to # send the mail to the target user. # XXXSRCID This should check a separate field like - # 'openproxy' instead of piggybacking off of 'nopost' + # 'openproxy' instead of piggybacking off of the + # existing nopost and spammer my $srcids_to_check = $user->{srcids}; $err_name = 'mailpasswd_readonly_err' - if $reader->checkAL2($srcids_to_check, 'nopost'); + if $reader->checkAL2($srcids_to_check, [qw( nopost spammer )]); } if (!$err_name) { $err_name = 'mailpasswd_toooften_err' @@ -3176,7 +3177,7 @@ sub listReadOnly { my $reader = getObject('Slash::DB', { db_type => 'reader' }); - my $readonlylist = $reader->getAL2List('nopost'); + my $readonlylist = $reader->getAL2List([qw( nopost spammer )]); slashDisplay('listReadOnly', { readonlylist => $readonlylist, Modified: slashjp/branches/upstream/current/themes/slashcode/tasks/process_file_queue.pl =================================================================== --- slashjp/branches/upstream/current/themes/slashcode/tasks/process_file_queue.pl 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/themes/slashcode/tasks/process_file_queue.pl 2007-11-02 07:50:12 UTC (rev 237) @@ -1,8 +1,8 @@ -#!/usr/bin/perl -w +#!/usr/local/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: process_file_queue.pl,v 1.2 2007/10/23 20:58:05 tvroom Exp $ +# $Id: process_file_queue.pl,v 1.6 2007/10/31 20:27:40 tvroom Exp $ use File::Path; use File::Temp; @@ -29,10 +29,13 @@ $file_queue_cmds = $slashdb->getNextFileQueueCmds(); } $cmd = shift @$file_queue_cmds; - if ($cmd->{blobid}) { - $cmd->{file} = blobToFile($cmd->{blobid}); - } - if($cmd) { + if ($cmd) { + if ($cmd->{blobid}) { + $cmd->{file} = blobToFile($cmd->{blobid}); + } + if ($cmd->{action} eq 'upload' && $cmd->{file} =~ /\.(jpg|gif|png)/i) { + $cmd->{action} = "thumbnails"; + } handleFileCmd($cmd); } last if $task_exit_flag; @@ -55,20 +58,29 @@ my $thumb = $namebase . "-thumb." . $suffix; my $thumbsm = $namebase . "-thumbsm." . $suffix; slashdLog("About to create thumb $path$thumb"); - system("convert -size 100x100 $path$name $path$thumb"); + system("/usr/bin/convert -size 260x194 $path$name -resize '130x97>' -bordercolor transparent -border 48 -gravity center -crop 130x97+0+0 -page +0+0 $path$thumb"); my $data = { - stoid => $cmd->{stoid}, - name => $thumb + stoid => $cmd->{stoid} || 0, + fhid => $cmd->{fhid} || 0 , + name => "$path$thumb" }; - addStoryFile($data, $path); + my $sfid = addFile($data); + if ($cmd->{fhid}) { + my $firehose = getObject("Slash::FireHose"); + if ($firehose) { + $firehose->setFireHose($cmd->{fhid}, { thumb => $sfid }); + } + } + slashdLog("About to create thumbsms $path$thumbsm"); - system("convert -size 50x50 $path$name $path$thumbsm"); + system("/usr/bin/convert -size 100x74 $path$name -resize '50x37>' -bordercolor transparent -border 18 -gravity center -crop 50x37+0+0 -page +0+0 $path$thumbsm"); $data = { - stoid => $cmd->{stoid}, - name => $thumbsm + stoid => $cmd->{stoid} || 0, + fhid => $cmd->{fhid} || 0, + name => "$path$thumbsm" }; - addStoryFile($data, $path); + addFile($data); } } if ($cmd->{action} eq "upload") { @@ -77,7 +89,7 @@ } $slashdb->deleteFileQueueCmd($cmd->{fqid}); if (verifyFileLocation($cmd->{file})) { - unlink $cmd->{file}; + # unlink $cmd->{file}; } } @@ -118,8 +130,10 @@ my($suffix) = $blob_ref->{filename} =~ /(\.\w+$)/; $suffix = lc($suffix); my ($ofh, $tmpname) = mkstemps("/tmp/upload/fileXXXXXX", $suffix ); + slashdLog("Writing file data to $tmpname\n"); print $ofh $blob_ref->{data}; close $ofh; + $blob->delete($blobid); return $tmpname; } @@ -144,11 +158,12 @@ push @files, $destfile if $destfile; my $name = fileparse($destfile); my $data = { - stoid => $cmd->{stoid}, - name => $name + stoid => $cmd->{stoid} || 0, + fhid => $cmd->{fhid} || 0, + name => "$destpath/$name" }; - addStoryFile($data, "$destpath/"); + addFile($data); } @@ -158,8 +173,18 @@ makeFileDir($destpath); my $numdir = sprintf("%09d",$cmd->{fhid}); my ($prefix) = $numdir =~ /\d\d\d\d\d\d(\d\d\d)/; - my $destfile = copyFileToLocation($cmd->{file}, $destpath, $prefix); - push @files, $destfile if $destfile; + if (verifyFileLocation($file)) { + my $destfile = copyFileToLocation($file, $destpath, $prefix); + my $name = fileparse($destfile); + push @files, $destfile if $destfile; + my $data = { + stoid => $cmd->{stoid} || 0, + fhid => $cmd->{fhid} || 0, + name => "$destpath/$name" + }; + slashdLog("Add firehose item: $data->{name}"); + addFile($data); + } } return \@files; } @@ -192,16 +217,16 @@ return $ret_val; } -sub addStoryFile { - my($data, $path) = @_; +sub addFile { + my($data) = @_; print "Add story file\n"; my $slashdb = getCurrentDB(); - slashdLog("addStoryFile $path $data->{name}"); - if ($data->{name} =~ /\.(png|gif|jpg)$/i && $path) { - ($data->{width}, $data->{height}) = imgsize("$path$data->{name}"); - slashdLog("addStoryFile $data->{width} $data->{height}"); + slashdLog("addFile $data->{name}"); + if ($data->{name} =~ /\.(png|gif|jpg)$/i) { + ($data->{width}, $data->{height}) = imgsize("$data->{name}"); + slashdLog("addFile $data->{width} $data->{height}"); } - $slashdb->addStoryStaticFile($data); + return $slashdb->addStaticFile($data); } 1; Modified: slashjp/branches/upstream/current/themes/slashcode/templates/edit_comment;comments;default =================================================================== --- slashjp/branches/upstream/current/themes/slashcode/templates/edit_comment;comments;default 2007-10-31 07:09:12 UTC (rev 236) +++ slashjp/branches/upstream/current/themes/slashcode/templates/edit_comment;comments;default 2007-11-02 07:50:12 UTC (rev 237) @@ -156,8 +156,18 @@ Create an Account! [% END %] - +[% IF !user.is_anon && user.discussion2 && user.discussion2 == "slashdot"; + prefslink = "Customize Posting Preferences

 
"; + + prefslink; +END %] + [% IF !user.is_anon && user.karma > constants.goodkarma %] No Karma Bonus @@ -245,7 +255,15 @@ + +

+ __seclev__ 1000 __version__ -$Id: edit_comment;comments;default,v 1.51 2007/10/24 20:09:52 jamiemccarthy Exp $ +$Id: edit_comment;comments;default,v 1.52 2007/10/31 19:59:58 entweichen Exp $ From svnnotify @ sourceforge.jp Fri Nov 2 16:59:48 2007 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Fri, 02 Nov 2007 16:59:48 +0900 Subject: [Slashdotjp-dev 729] [239] merged from 2.5.0.182 branch Message-ID: <1193990388.409552.23566.nullmailer@users.sourceforge.jp> Revision: 239 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=239 Author: tach Date: 2007-11-02 16:59:46 +0900 (Fri, 02 Nov 2007) Log Message: ----------- merged from 2.5.0.182 branch Modified Paths: -------------- slashjp/trunk/Bundle/Slash.pm slashjp/trunk/Slash/DB/MySQL/MySQL.pm slashjp/trunk/Slash/Slash.pm slashjp/trunk/plugins/Admin/admin.pl slashjp/trunk/plugins/Admin/templates/editStory;admin;default slashjp/trunk/plugins/Admin/templates/static_files;admin;default slashjp/trunk/plugins/Ajax/PLUGIN slashjp/trunk/plugins/Ajax/htdocs/ajax.pl slashjp/trunk/plugins/Ajax/htdocs/images/admin.js slashjp/trunk/plugins/Ajax/htdocs/images/common.js slashjp/trunk/plugins/Blob/Blob.pm slashjp/trunk/plugins/Bookmark/bookmark.pl slashjp/trunk/plugins/Bookmark/mysql_dump.sql slashjp/trunk/plugins/Bookmark/mysql_schema.sql slashjp/trunk/plugins/FireHose/FireHose.pm slashjp/trunk/plugins/FireHose/PLUGIN slashjp/trunk/plugins/FireHose/mysql_schema.sql slashjp/trunk/plugins/FireHose/templates/dispFireHose;firehose;default slashjp/trunk/plugins/FireHose/templates/nodnix_menus;firehose;default slashjp/trunk/plugins/HumanConf/Static/Static.pm slashjp/trunk/plugins/Journal/Journal.pm slashjp/trunk/plugins/Journal/mysql_schema slashjp/trunk/plugins/Login/login.pl slashjp/trunk/plugins/Metamod/templates/dispTheComments;metamod;default slashjp/trunk/plugins/ResKey/mysql_dump.sql slashjp/trunk/plugins/Tags/Tags.pm slashjp/trunk/plugins/Tags/templates/tagsstorydivadmin;misc;default slashjp/trunk/plugins/Tags/templates/tagsurldivadmin;misc;default slashjp/trunk/sql/mysql/defaults.sql slashjp/trunk/sql/mysql/slashschema_create.sql slashjp/trunk/sql/mysql/upgrades slashjp/trunk/tagboxes/Top/Top.pm slashjp/trunk/tagboxes/Top/mysql_dump.sql slashjp/trunk/themes/slashcode/htdocs/comments.css slashjp/trunk/themes/slashcode/htdocs/images/comments.js slashjp/trunk/themes/slashcode/htdocs/users.pl slashjp/trunk/themes/slashcode/tasks/process_file_queue.pl slashjp/trunk/themes/slashcode/templates/edit_comment;comments;default Added Paths: ----------- slashjp/trunk/plugins/Ajax/templates/prefs_d2_posting;ajax;default slashjp/trunk/plugins/FireHose/firehose_get_thumbnails.pl slashjp/trunk/plugins/FireHose/templates/dispTopicFireHose;misc;default slashjp/trunk/plugins/ResKey/ResKey/Checks/AL2/Spammer.pm slashjp/trunk/tagboxes/Despam/ slashjp/trunk/tagboxes/Despam/Despam.pm slashjp/trunk/tagboxes/Despam/Makefile.PL slashjp/trunk/tagboxes/Despam/TAGBOX slashjp/trunk/tagboxes/Despam/mysql_dump.sql -------------- next part -------------- Modified: slashjp/trunk/Bundle/Slash.pm =================================================================== --- slashjp/trunk/Bundle/Slash.pm 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/Bundle/Slash.pm 2007-11-02 07:59:46 UTC (rev 239) @@ -134,6 +134,6 @@ and thus not installed by default, but which may become required as you edit your site configuration, are: Cache::Memcached Silly::Werder GD GD::Text GD::Graph Apache::SSI Apache::RegistryFilter GraphViz -Net::IRC Proc::ProcessTable Net::Jabber +Net::IRC Proc::ProcessTable Net::Jabber File::Type =cut Modified: slashjp/trunk/Slash/DB/MySQL/MySQL.pm =================================================================== --- slashjp/trunk/Slash/DB/MySQL/MySQL.pm 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/Slash/DB/MySQL/MySQL.pm 2007-11-02 07:59:46 UTC (rev 239) @@ -5368,18 +5368,26 @@ sub checkAL2 { my($self, $srcids, $type) = @_; + my $type_ar = ref($type) ? $type : [ $type ]; # If the caller is querying about a type that does not # exist for this site, that's OK, it just means that no - # srcid can have it. So we can return without querying - # the DB. + # srcid can have it. If none of the types given exist, + # we can return without querying the DB. my $types = $self->getAL2Types(); - return 0 if !exists $types->{$type}; + my $any_exist = 0; + for my $t (@$type_ar) { + $any_exist = 1, last if exists $types->{$t}; + } + return 0 unless $any_exist; - # It's at least possible that the srcids have this type, - # so run the check. + # It's at least possible that the srcids have one or more + # of these types, so run the check. my $data = $self->getAL2($srcids); - return $data->{$type} ? 1 : 0; + for my $t (@$type_ar) { + return 1 if exists $types->{$t} && $data->{$type}; + } + return 0; } sub getAL2List { @@ -12499,9 +12507,10 @@ $self->sqlCount("file_queue", "stoid=$stoid_q"); } -sub addStoryStaticFile { +sub addStaticFile { my($self, $data) = @_; - $data ||= ""; + my $constants = getCurrentStatic(); + $data ||= {}; # Guess at file type if it isn't set if ($data->{name} =~ /\.(jpg|gif|png)$/) { @@ -12509,16 +12518,28 @@ } elsif ($data->{name} =~ /\.(jpg|gif|png)$/) { $data->{filetype} ||= "audio"; } + $data->{name} =~ s/^\Q$constants->{basedir}\E\/images//g; - $self->sqlInsert("story_static_files", $data); + $self->sqlInsert("static_files", $data); + my $sfid = $self->getLastInsertId; + return $sfid; } sub getStaticFilesForStory { my($self, $stoid) = @_; my $stoid_q = $self->sqlQuote($stoid); - return $self->sqlSelectAllHashrefArray("*", "story_static_files", "stoid=$stoid_q"); + return $self->sqlSelectAllHashrefArray("*", "static_files", "stoid=$stoid_q"); } +sub getStaticFile { + my $answer = _genericGetCache({ + table => 'static_files', + table_prime => 'sfid', + arguments => \@_, + }); + return $answer; +} + ######################################################## sub DESTROY { my($self) = @_; Modified: slashjp/trunk/Slash/Slash.pm =================================================================== --- slashjp/trunk/Slash/Slash.pm 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/Slash/Slash.pm 2007-11-02 07:59:46 UTC (rev 239) @@ -72,6 +72,8 @@ my($min, $max) = ($constants->{comment_minscore}, $constants->{comment_maxscore}); my $num_scores = $max - $min + 1; +# print STDERR scalar(gmtime) . " selectComments cid undef for $discussion\n" if !defined($cid); + $cid ||= 0; my $discussion2 = discussion2($user); @@ -139,8 +141,8 @@ # I'm still looking into how to get parent links and # children to show up properly in flat mode. - Jamie 2002/07/30 # $user->{state}{noreparent} = 1 if $commentsort > 3; - - $C->{points} = _get_points($C, $user, $min, $max, $max_uid, $reasons); +#my $errstr = "selectComments discid=$discussion->{id} cid=$cid options=" . Dumper($options); $errstr =~ s/\s+/ /g; + $C->{points} = _get_points($C, $user, $min, $max, $max_uid, $reasons); # , $errstr } my $d2_comment_q = $user->{d2_comment_q}; @@ -518,7 +520,8 @@ } sub _get_points { - my($C, $user, $min, $max, $max_uid, $reasons) = @_; + my($C, $user, $min, $max, $max_uid, $reasons, $errstr) = @_; +#use Data::Dumper; print STDERR scalar(gmtime) . " _get_points errstr='$errstr' C: " . Dumper($C) if !defined($C->{pointsorig}) || !defined($C->{tweak_orig}) || !defined($C->{points}) || !defined($C->{tweak}); my $hr = { score_start => constrain_score($C->{pointsorig} + $C->{tweak_orig}), moderations => constrain_score($C->{points} + $C->{tweak}) - constrain_score($C->{pointsorig} + $C->{tweak_orig}), @@ -720,7 +723,8 @@ # But, if all its (great-etc.) grandparents are either invisible # or chronologically precede the root comment, don't reparent it # at all. - if ($user->{reparent} && $comments->{$x}{points} >= $threshold) { # XXX either $comments->{$x}{points} or $threshold is undefined here, not sure which or why + # XXX either $comments->{$x}{points} or $threshold is sometimes undefined here, not sure which or why + if ($user->{reparent} && $comments->{$x}{points} >= $threshold) { my $tmppid = $pid; while ($tmppid && $comments->{$tmppid} && defined($comments->{$tmppid}{points}) @@ -1621,14 +1625,14 @@ # Only do the following if force_cache_freshen is not set: # as it is by freshenup.pl when (re)building the 'rendered' # cached data for a story. - my $df = ($user->{mode} eq "archive" || ($story->{is_archived} eq "yes" && $user->{is_anon})) - ? $constants->{archive_dateformat} : ""; - my $storytime = timeCalc($story->{'time'}, $df); + my $is_old = $user->{mode} eq 'archive' || ($story->{is_archived} eq 'yes' && $user->{is_anon}); + my $df = $is_old ? $constants->{archive_dateformat} : ''; my $atstorytime; if ($options->{is_future} && !($user->{author} || $user->{is_admin})) { $atstorytime = $constants->{subscribe_future_name}; } else { - $atstorytime = $user->{aton} . " " . timeCalc($story->{'time'}, $df); + $atstorytime = $user->{aton} . ' ' + . timeCalc($story->{'time'}, $df, 0, { is_old => $is_old }); } $return =~ s/\Q__TIME_TAG__\E/$atstorytime/; Modified: slashjp/trunk/plugins/Admin/admin.pl =================================================================== --- slashjp/trunk/plugins/Admin/admin.pl 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/plugins/Admin/admin.pl 2007-11-02 07:59:46 UTC (rev 239) @@ -2021,7 +2021,7 @@ my $time = findTheTime(); - for my $field (qw( introtext bodytext )) { + for my $field (qw( introtext bodytext media)) { local $Slash::Utility::Data::approveTag::admin = 2; $form->{$field} = cleanSlashTags($form->{$field}); $form->{$field} = strip_html($form->{$field}); @@ -2060,8 +2060,10 @@ commentstatus => $form->{commentstatus}, bodytext => $form->{bodytext}, introtext => $form->{introtext}, + media => $form->{media}, relatedtext => $form->{relatedtext}, related_sids => $related_sids, + thumb => $form->{thumb}, -rendered => 'NULL', # freshenup.pl will write this is_dirty => 1 }; @@ -2147,7 +2149,7 @@ if ($savefile) { close $ofh; } - my $action = $form->{media_action} eq "thumbnails" ? "thumbnails" : "upload"; + my $action = "upload"; my $file = { stoid => $stoid, action => $action, @@ -2458,9 +2460,11 @@ bodytext => $form->{bodytext}, introtext => $form->{introtext}, relatedtext => $form->{relatedtext}, + media => $form->{media}, subid => $form->{subid}, fhid => $form->{fhid}, commentstatus => $form->{commentstatus}, + thumb => $form->{thumb}, -rendered => 'NULL', # freshenup.pl will write this }; Modified: slashjp/trunk/plugins/Admin/templates/editStory;admin;default =================================================================== --- slashjp/trunk/plugins/Admin/templates/editStory;admin;default 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/plugins/Admin/templates/editStory;admin;default 2007-11-02 07:59:46 UTC (rev 239) @@ -248,26 +248,39 @@ - + [% IF story_static_files && story_static_files.size %] + [% FOREACH mfile = story_static_files %] - [% trunc_name = mfile.name %] - [% trunc_name = trunc_name.replace('^\d+',"") %] - - + [% filename = mfile.name %] + [% filename = filename.replace(".*\/", ""); %] + + [% END %] +
Select
Thumb
Click to
add to body
[% mfile.sfid %][% mfile.name %][% constants.imagedir %]/articles/[% sid %][% trunc_name %][% mfile.width %]
[% filename %][% mfile.width %] [% mfile.height %] [% IF mfile.filetype == "image" %] - +[% height = mfile.height; width = mfile.width %] +[% IF width && height %] + [% WHILE (height > 225 || width > 225) %] + [% height = height / 1.3 %] + [% width = width / 1.3 %] + [% END %] + [% width = width.int %] + [% height = height.int %] [% END %] + +[% ELSE %] +Add [% filename %] +[% END %]
None
[% END %] @@ -275,10 +288,15 @@ Upload a file for bodytext + - + + +
[% ispell_comments.bodytext %]
[% PROCESS editbuttons %] Modified: slashjp/trunk/plugins/Admin/templates/static_files;admin;default =================================================================== --- slashjp/trunk/plugins/Admin/templates/static_files;admin;default 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/plugins/Admin/templates/static_files;admin;default 2007-11-02 07:59:46 UTC (rev 239) @@ -15,11 +15,9 @@ __template__ [% FOREACH mfile = story_static_files %] - [% trunc_name = mfile.name %] - [% trunc_name = trunc_name.replace('^\d+',"") %] - + [% IF mfile.filetype == "image" %] - + [% END %] [% END %] Modified: slashjp/trunk/plugins/Ajax/PLUGIN =================================================================== --- slashjp/trunk/plugins/Ajax/PLUGIN 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/plugins/Ajax/PLUGIN 2007-11-02 07:59:46 UTC (rev 239) @@ -34,3 +34,4 @@ template=templates/sectionpref;ajax;default template=templates/datewidget;misc;default template=templates/prefs_d2;ajax;default +template=templates/prefs_d2_posting;ajax;default Modified: slashjp/trunk/plugins/Ajax/htdocs/ajax.pl =================================================================== --- slashjp/trunk/plugins/Ajax/htdocs/ajax.pl 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/plugins/Ajax/htdocs/ajax.pl 2007-11-02 07:59:46 UTC (rev 239) @@ -520,16 +520,38 @@ my $url = URI->new('//e.a/?' . $form->{'data'}); my %params = $url->query_form; - # Specific to D2 for the time being - my $user_edits_table = { - d2_comment_q => $params{'d2_comment_q'} || undef, - d2_comment_order => $params{'d2_comment_order'} || undef, - nosigs => ($params{'nosigs'} ? 1 : 0), - noscores => ($params{'noscores'} ? 1 : 0), - domaintags => ($params{'domaintags'} != 2 ? $params{'domaintags'} : undef), - m2_with_comm_mod => ($params{'m2_with_mod_on_comm'} ? 1 : undef), - }; - + # Specific to D2 display and posting prefs for the time being. + my $user_edits_table; + if ($params{'formname'} eq 'd2_display') { + $user_edits_table = { + discussion2 => ($params{'discussion2'}) ? 'slashdot' : 'none', + d2_comment_q => $params{'d2_comment_q'} || undef, + d2_comment_order => $params{'d2_comment_order'} || undef, + nosigs => ($params{'nosigs'} ? 1 : 0), + noscores => ($params{'noscores'} ? 1 : 0), + domaintags => ($params{'domaintags'} != 2 ? $params{'domaintags'} : undef), + m2_with_comm_mod => ($params{'m2_with_mod_on_comm'} ? 1 : undef), + } + } + else { + my $karma_bonus = ($params{'karma_bonus'} !~ /^[\-+]?\d+$/) ? "+1" : $params{'karma_bonus'}; + my $subscriber_bonus = ($params{'subscriber_bonus'} !~ /^[\-+]?\d+$/) ? "+1" : $params{'subscriber_bonus'}; + $user_edits_table = { + emaildisplay => $params{'emaildisplay'} || undef, + karma_bonus => ($karma_bonus ne '+1' ? $karma_bonus : undef), + nobonus => ($params{'nobonus'} ? 1 : undef), + subscriber_bonus => ($subscriber_bonus || undef), + nosubscriberbonus => ($params{'nosubscriberbonus'} ? 1 : undef), + posttype => $params{'posttype'}, + textarea_rows => ($params{'textarea_rows'} != $constants->{'textarea_rows'} + ? $params{'textarea_rows'} : undef), + textarea_cols => ($params{'textarea_cols'} != $constants->{'textarea_cols'} + ? $params{'textarea_cols'} : undef), + postanon => ($params{'postanon'} ? 1 : undef), + no_spell => ($params{'no_spell'} ? 1 : undef), + }; + } + $slashdb->setUser($params{uid}, $user_edits_table); } Modified: slashjp/trunk/plugins/Ajax/htdocs/images/admin.js =================================================================== --- slashjp/trunk/plugins/Ajax/htdocs/images/admin.js 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/plugins/Ajax/htdocs/images/admin.js 2007-11-02 07:59:46 UTC (rev 239) @@ -301,3 +301,11 @@ }; ajax_update(params, 'postform-'+id, handlers); } + +function appendToBodytext(text) { + var obj = $('admin-bodytext'); + if (obj) { + obj.className = "show"; + obj.value = obj.value + text; + } +} Modified: slashjp/trunk/plugins/Ajax/htdocs/images/common.js =================================================================== --- slashjp/trunk/plugins/Ajax/htdocs/images/common.js 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/plugins/Ajax/htdocs/images/common.js 2007-11-02 07:59:46 UTC (rev 239) @@ -139,6 +139,17 @@ obj.className = ""; } +function toggleId(id, first, second) { + var obj =$(id); + if (obj.className == first) { + obj.className = second; + } else if (obj.className == second) { + obj.className = first; + } else { + obj.className = first; + } +} + function toggleIntro(id, toggleid) { var obj = $(id); var toggle = $(toggleid); @@ -1432,6 +1443,12 @@ params['op'] = 'saveModalPrefs'; params['data'] = Form.serialize(document.forms['modal_prefs']); params['reskey'] = reskey_static; - var handlers = {onComplete:hide_modal_box}; + var handlers = { + onComplete: function() { + hide_modal_box(); + if (document.forms['modal_prefs'].refreshable.value) + document.location=document.forms['modal_prefs'].refreshable.value; + } + }; ajax_update(params, '', handlers); } Added: slashjp/trunk/plugins/Ajax/templates/prefs_d2_posting;ajax;default =================================================================== --- slashjp/trunk/plugins/Ajax/templates/prefs_d2_posting;ajax;default 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/plugins/Ajax/templates/prefs_d2_posting;ajax;default 2007-11-02 07:59:46 UTC (rev 239) @@ -0,0 +1,140 @@ +__section__ +default +__description__ +__title__ + +__page__ +ajax +__lang__ +en_US +__name__ +prefs_d2_posting +__template__ + +[% hi = constants.comment_maxscore - constants.comment_minscore %] +[% lo = '-' _ hi %] +[% range = [ lo .. hi ] %] + + + + + + +
[% mfile.sfid %][% mfile.name %][% constants.imagedir %]/articles/[% sid %][% trunc_name %][% mfile.width %][% mfile.height %]
[% mfile.sfid %][% mfile.name %][% constants.imagedir %][% mfile.name %][% mfile.width %][% mfile.height %]
+ + + +
+  

+ + Email Display + (currently + [%- IF !user.fakeemail; " not displayed"; + ELSE; ": "; user.fakeemail | strip_literal; ""; + END %])
+ [% IF !user.emaildisplay.defined; + IF user.fakeemail %] + (Your current email address was apparently set before + users' email addresses were forced to one of the below + choices. Please pick one and click Save.)
+ [% END; + user.emaildisplay = 0; + END; + IF user.emaildisplay.defined; + emaildisplay.${user.emaildisplay} = constants.markup_checked_attribute; + END %] +

+ Do not display an e-mail address.
+ Show your email address with weekly updating spam armoring.
+ Show your real email address without cowering behind childish anonymity or obfuscation. +
+ + Karma Bonus (modifier assigned to posts where the user has good karma)
+ [% karma_bonus = 0; + IF user.karma_bonus; + karma_bonus = user.karma_bonus; + END %] + [% Slash.createSelect('karma_bonus', range, karma_bonus, 1, 1) %] + +  

+ + [% IF user.karma > constants.goodkarma; + b_check = ''; + IF user.nobonus; + b_check = constants.markup_checked_attribute; + END %] + + + +  

+ [% END %] + + Subscriber Bonus (modifier assigned to posts where the user was a subscriber)
+ [% subscriber_bonus = 0; + IF user.subscriber_bonus; + subscriber_bonus = user.subscriber_bonus; + END %] + [% Slash.createSelect('subscriber_bonus', range, subscriber_bonus, 1, 1) %] + +  

+ + [% IF user.is_subscriber; + sb_check = ''; + IF user.nosubscriberbonus; + sb_check = constants.markup_checked_attribute; + END %] + + + [% END %] + + + [% textarea_cols = constants.textarea_cols; + IF user.textarea_cols; + textarea_cols = user.textarea_cols; + END; + + textarea_rows = constants.textarea_rows; + IF user.textarea_rows; + textarea_rows = user.textarea_rows; + END %] + + Columns: + Rows: + [% PROCESS formNote note="Also applies to other large text boxes" %] + + + [% + formats = Slash.db.getDescriptions('postmodes'); + Slash.createSelect('posttype', formats, user.posttype, 1); + %] + +  

+ + [% + p_check = ''; + IF user.postanon; + p_check = constants.markup_checked_attribute; + END; + %] + + [% IF constants.allow_anonymous && (user.karma > -1 || p_check) %] + + + + [% END %] + + [% IF user.is_admin; + nospell_check = ''; + IF user.no_spell; + nospell_check = constants.markup_checked_attribute; + END %] + + [% END %] +

+ + +__seclev__ +500 +__version__ +$Id: $ Modified: slashjp/trunk/plugins/Blob/Blob.pm =================================================================== --- slashjp/trunk/plugins/Blob/Blob.pm 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/plugins/Blob/Blob.pm 2007-11-02 07:59:46 UTC (rev 239) @@ -185,7 +185,7 @@ sub get { my($self, $sig) = @_; my $sig_q = $self->sqlQuote($sig); - return $self->sqlSelectHashref($self->{_table}, "id = $sig_q"); + return $self->sqlSelectHashref("*", $self->{_table}, "id = $sig_q"); } sub getFilesForStories { Modified: slashjp/trunk/plugins/Bookmark/bookmark.pl =================================================================== --- slashjp/trunk/plugins/Bookmark/bookmark.pl 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/plugins/Bookmark/bookmark.pl 2007-11-02 07:59:46 UTC (rev 239) @@ -110,6 +110,8 @@ url_id => $url_id, uid => $user->{uid}, title => strip_notags($form->{title}), + srcid_32 => get_srcid_sql_in($user->{srcids}{32}), + srcid_24 => get_srcid_sql_in($user->{srcids}{24}), }; my $bookmark_id; Modified: slashjp/trunk/plugins/Bookmark/mysql_dump.sql =================================================================== --- slashjp/trunk/plugins/Bookmark/mysql_dump.sql 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/plugins/Bookmark/mysql_dump.sql 2007-11-02 07:59:46 UTC (rev 239) @@ -8,6 +8,7 @@ INSERT IGNORE INTO reskey_vars VALUES (8, 'duration_max-uses', '30', 'how many uses per timeframe'); INSERT INTO reskey_resource_checks (rkrcid, rkrid, type, class, ordernum) VALUES (NULL, 8,'use','Slash::ResKey::Checks::Post',151); +INSERT INTO reskey_resource_checks (rkrcid, rkrid, type, class, ordernum) VALUES (NULL, 8,'all','Slash::ResKey::Checks::Spammer',531); INSERT INTO reskey_resource_checks (rkrcid, rkrid, type, class, ordernum) VALUES (NULL, 8,'all','Slash::ResKey::Checks::Duration',601); INSERT INTO reskey_resource_checks (rkrcid, rkrid, type, class, ordernum) VALUES (NULL ,8,'all','Slash::ResKey::Checks::User',101); Modified: slashjp/trunk/plugins/Bookmark/mysql_schema.sql =================================================================== --- slashjp/trunk/plugins/Bookmark/mysql_schema.sql 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/plugins/Bookmark/mysql_schema.sql 2007-11-02 07:59:46 UTC (rev 239) @@ -5,8 +5,12 @@ url_id MEDIUMINT UNSIGNED NOT NULL, createdtime DATETIME NOT NULL, title VARCHAR(255), + srcid_32 BIGINT UNSIGNED NOT NULL DEFAULT 0, + srcid_24 BIGINT UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY(bookmark_id), - UNIQUE url_id_uid (url_id, uid) + UNIQUE url_id_uid (url_id, uid), + INDEX srcid_32 (srcid_32), + INDEX srcid_24 (srcid_24) ); DROP TABLE IF EXISTS bookmark_feeds; Modified: slashjp/trunk/plugins/FireHose/FireHose.pm =================================================================== --- slashjp/trunk/plugins/FireHose/FireHose.pm 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/plugins/FireHose/FireHose.pm 2007-11-02 07:59:46 UTC (rev 239) @@ -59,6 +59,7 @@ $text_data->{title} = delete $data->{title}; $text_data->{introtext} = delete $data->{introtext}; $text_data->{bodytext} = delete $data->{bodytext}; + $text_data->{media} = delete $data->{media}; $self->sqlDo('SET AUTOCOMMIT=0'); my $ok = $self->sqlInsert("firehose", $data); @@ -156,7 +157,9 @@ tid => $journal->{tid}, srcid => $id, discussion => $journal->{discussion}, - type => $type + type => $type, + ipid => $user->{ipid}, + subnetid => $user->{subnetid}, }; $self->createFireHose($data); if ($publicize && !isAnon($journal->{uid})) { @@ -302,6 +305,7 @@ createtime => $story->{time}, introtext => parseSlashizedLinks($story->{introtext}), bodytext => parseSlashizedLinks($story->{bodytext}), + media => $story->{media}, primaryskid => $story->{primaryskid}, tid => $story->{tid}, public => $public, @@ -309,6 +313,7 @@ discussion => $story->{discussion}, body_length => $story->{body_length}, word_count => $story->{word_count}, + thumb => $story->{thumb}, }; $self->setFireHose($id, $data); @@ -338,6 +343,7 @@ createtime => $story->{time}, introtext => parseSlashizedLinks($story->{introtext}), bodytext => parseSlashizedLinks($story->{bodytext}), + media => $story->{media}, popularity => $popularity, editorpop => $popularity, primaryskid => $story->{primaryskid}, @@ -347,6 +353,7 @@ public => $public, dept => $story->{dept}, discussion => $story->{discussion}, + thumb => $story->{thumb}, }; $self->createFireHose($data); } @@ -1128,6 +1135,7 @@ slashDisplay("formatHoseIntro", { introtext => $introtext, url => $url, $item => $item }, { Return => 1 }); $html->{"text-$_->{id}"} = $introtext; $html->{"fhtime-$_->{id}"} = timeCalc($item->{createtime}); + $html->{"topic-$_->{id}"} = slashDisplay("dispTopicFireHose", { item => $item, adminmode => $adminmode }, { Return => 1}); # updated } } @@ -1461,6 +1469,7 @@ $text_data->{title} = delete $data->{title} if defined $data->{title}; $text_data->{introtext} = delete $data->{introtext} if defined $data->{introtext}; $text_data->{bodytext} = delete $data->{bodytext} if defined $data->{bodytext}; + $text_data->{media} = delete $data->{media} if defined $data->{media}; $self->sqlUpdate('firehose', $data, "id=$id_q"); $self->sqlUpdate('firehose_text', $text_data, "id=$id_q") if keys %$text_data; @@ -2382,6 +2391,13 @@ slashDisplay("firehose_usage", $data, { Return => 1 }); } +sub getNextItemsForThumbnails { + my($self, $lastid, $limit) = @_; + $limit = " LIMIT $limit" if $limit; + $lastid = " AND firehose.id > $lastid" if defined $lastid; + return $self->sqlSelectAllHashrefArray("firehose.id,urls.url", "firehose,urls", "firehose.type='submission' AND firehose.url_id=urls.url_id AND mediatype='video' $lastid", "ORDER BY firehose.id ASC $limit"); +} + 1; __END__ Modified: slashjp/trunk/plugins/FireHose/PLUGIN =================================================================== --- slashjp/trunk/plugins/FireHose/PLUGIN 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/plugins/FireHose/PLUGIN 2007-11-02 07:59:46 UTC (rev 239) @@ -14,6 +14,7 @@ template=templates/datelaunch;misc;default template=templates/daybreak;firehose;default template=templates/dispFireHose;firehose;default +template=templates/dispTopicFireHose;misc;default template=templates/fhadvprefpane;misc;default template=templates/fireHoseForm;misc;default template=templates/firehose_pages;misc;default @@ -32,5 +33,6 @@ template=templates/tagsfirehosedivuser;misc;default task=firehose_reject_old.pl task=firehose_backend.pl +task=firehose_get_thumbnails.pl image=images/colorscale.png image=images/slidethumb.png Added: slashjp/trunk/plugins/FireHose/firehose_get_thumbnails.pl =================================================================== --- slashjp/trunk/plugins/FireHose/firehose_get_thumbnails.pl 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/plugins/FireHose/firehose_get_thumbnails.pl 2007-11-02 07:59:46 UTC (rev 239) @@ -0,0 +1,98 @@ +#!/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: $ + +use strict; + +use Time::HiRes; + +use Slash; +use Slash::Constants ':slashd'; +use Slash::Display; +use Slash::Utility; +use LWP::Simple; +use URI::Split qw(uri_split); +use File::Type; +use File::Temp; + +use vars qw( + %task $me $task_exit_flag +); + +$task{$me}{timespec} = '0-59/2 * * * *'; +$task{$me}{fork} = SLASHD_NOWAIT; +$task{$me}{code} = sub { + my($virtual_user, $constants, $slashdb, $user, $info, $gSkin) = @_; + my $fh_last = $slashdb->getVar("firehose_last_thumbnail_id", "value", 1); + if (!defined($fh_last)) { + $fh_last = 0; + $slashdb->createVar("firehose_last_thumbnail_id", 0); + } + my $firehose = getObject("Slash::FireHose"); + my $items = $firehose->getNextItemsForThumbnails($fh_last, 10); + + foreach (@$items) { + $fh_last = $_->{id} if $_->{id} > $fh_last; + my $thumb; + my ($scheme, $domain, $path, $query, $frag) = uri_split($_->{url}); + my $page = get $_->{url}; + slashdLog("$_->{id}: $_->{url}\n"); + my @pairs = split(/&/, $query); + my $params = {}; + foreach my $pair (@pairs) { + my ($name, $value) = split(/=/, $pair); + $params->{$name}= $value; + } + if ($page) { + if ($domain =~ /youtube\.com/ && $params->{v}) { + $thumb = "http://img.youtube.com/vi/$params->{v}/0.jpg"; + } elsif ($domain =~ /video.google.com/ && $params->{docid}) { + my $feed = get "http://video.google.com/videofeed?docid=$params->{docid}"; + $feed =~/new(); + my $thumb_data = get $thumb; + my $mimetype = $ft->mime_type($thumb_data); + + if ($mimetype =~ /^image/) { + if (length($thumb_data) < 600000 ) { + my $tmpfile = dataToTmpFile($thumb_data, $thumb); + my $file = { + fhid => $_->{id}, + file => $tmpfile, + action => "thumbnails" + }; + $slashdb->addFileToQueue($file); + } + } + } + } + } + slashdLog("Last id: $fh_last"); + $slashdb->setVar('firehose_last_thumbnail_id', $fh_last); +}; + +sub dataToTmpFile { + my($data, $url) = @_; + my ($suffix) = $url =~ /(\.\w+$)/; + $suffix = lc($suffix); + my ($ofh, $tmpname) = mkstemps("/tmp/upload/fileXXXXXX", $suffix ); + print $ofh $data; + close $ofh; + return $tmpname; +} + +1; + Modified: slashjp/trunk/plugins/FireHose/mysql_schema.sql =================================================================== --- slashjp/trunk/plugins/FireHose/mysql_schema.sql 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/plugins/FireHose/mysql_schema.sql 2007-11-02 07:59:46 UTC (rev 239) @@ -35,6 +35,7 @@ body_length MEDIUMINT UNSIGNED DEFAULT 0 NOT NULL, word_count MEDIUMINT UNSIGNED DEFAULT 0 NOT NULL, srcname VARCHAR(32) NOT NULL DEFAULT '', + thumb MEDIUMINT UNSIGNED, mediatype enum("text", "none", "video", "image", "audio") default "none" NOT NULL, PRIMARY KEY (id), UNIQUE globjid (globjid), @@ -56,6 +57,7 @@ title VARCHAR(80), introtext text, bodytext text, + media text, PRIMARY KEY (id) ) TYPE=InnoDB; Modified: slashjp/trunk/plugins/FireHose/templates/dispFireHose;firehose;default =================================================================== --- slashjp/trunk/plugins/FireHose/templates/dispFireHose;firehose;default 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/plugins/FireHose/templates/dispFireHose;firehose;default 2007-11-02 07:59:46 UTC (rev 239) @@ -75,21 +75,14 @@ [% IF bodywrapper; Slash.getData('byline', { adminmode => adminmode, item => item, the_user => the_user }, 'firehose'); %] - -

+ [% hasimage = item.tid || (item.thumb && item.type == "story") || (adminmode && item.type == "submission") %] +
[% END %] - [% IF item.tid %] -
+ [% IF hasimage %] +
[% IF bodycontent %] - [% topic = Slash.db.getTopic(item.tid) %] - [% IF user.noicons || user.simpledesign || user.lowbandwidth %] - [ [% topic.textname %] ] - [% ELSIF topic.image %] - - [% topic.textname %] - + [% PROCESS dispTopicFireHose item = item %] [% END %] - [% END %]
[% END %]
@@ -99,6 +92,11 @@ PROCESS formatHoseIntro; END %] [% introtext %] + [% IF item.media %] +
+ [% item.media %] +
+ [% END %]
[% IF bodywrapper %]
Added: slashjp/trunk/plugins/FireHose/templates/dispTopicFireHose;misc;default =================================================================== --- slashjp/trunk/plugins/FireHose/templates/dispTopicFireHose;misc;default 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/plugins/FireHose/templates/dispTopicFireHose;misc;default 2007-11-02 07:59:46 UTC (rev 239) @@ -0,0 +1,39 @@ +__section__ +default +__description__ +You should describe stuff here. +__title__ +Useless title to template +__page__ +misc +__lang__ +en_US +__name__ +dispTopicFireHose +__seclev__ +10000 +__template__ +[% topic = Slash.db.getTopic(item.tid) %] +[% IF (item.thumb && (item.type == "story" || (item.type == "submission" && adminmode))) %] + [% file = Slash.db.getStaticFile(item.thumb); %] + [% link_url = ""; + IF item.type == "story"; + story_link_ar = Slash.linkStory ({ + sid => story.sid, + link => story.title, + tid => story.tid + skin => story.primaryskid + }, 0); + link_url = story_link_ar.0; + ELSE; + link_url = constants.rootdir _ "/firehose.pl?op=view&id=" _ item.id; + END %] + thumbnail + +[% ELSIF user.noicons || user.simpledesign || user.lowbandwidth %] + [ [% topic.textname %] ] +[% ELSIF topic.image %] + + [% topic.textname %] + +[% END %] Modified: slashjp/trunk/plugins/FireHose/templates/nodnix_menus;firehose;default =================================================================== --- slashjp/trunk/plugins/FireHose/templates/nodnix_menus;firehose;default 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/plugins/FireHose/templates/nodnix_menus;firehose;default 2007-11-02 07:59:46 UTC (rev 239) @@ -1,7 +1,9 @@ __section__ default __description__ -You should describe stuff here. +If the list of these tags is changed, consider also updating the var +'tagbox_top_excludetagnames'. + __title__ Useless title to template __page__ Modified: slashjp/trunk/plugins/HumanConf/Static/Static.pm =================================================================== --- slashjp/trunk/plugins/HumanConf/Static/Static.pm 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/plugins/HumanConf/Static/Static.pm 2007-11-02 07:59:46 UTC (rev 239) @@ -347,7 +347,7 @@ my $constants = getCurrentStatic(); my $filename_mp3 = sprintf("%02d/%s%s", $hcpid % 100, $encoded_name, '.mp3'); my $full_filename_mp3 = "$dir/$filename_mp3"; - my $ssml_text = join('', + my $ssml_text = join(' ', "\u$answer.", map { "\u$_." } split //, $answer); Modified: slashjp/trunk/plugins/Journal/Journal.pm =================================================================== --- slashjp/trunk/plugins/Journal/Journal.pm 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/plugins/Journal/Journal.pm 2007-11-02 07:59:46 UTC (rev 239) @@ -191,14 +191,16 @@ my $constants = getCurrentStatic(); - my $uid = getCurrentUser('uid'); + my $user = getCurrentUser(); $self->sqlInsert("journals", { - uid => $uid, + uid => $user->{uid}, description => $description, tid => $tid, - -date => 'now()', + -date => 'NOW()', posttype => $posttype, - promotetype => $promotetype + promotetype => $promotetype, + srcid_24 => get_srcid_sql_in($user->{srcids}{24}), + srcid_32 => get_srcid_sql_in($user->{srcids}{32}), }); my($id) = $self->getLastInsertId({ table => 'journals', prime => 'id' }); @@ -211,7 +213,7 @@ my($date) = $self->sqlSelect('date', 'journals', "id=$id"); my $slashdb = getCurrentDB(); - $slashdb->setUser($uid, { journal_last_entry_date => $date }); + $slashdb->setUser($user->{uid}, { journal_last_entry_date => $date }); if ($constants->{plugin}{FireHose}) { my $reskey = getObject('Slash::ResKey'); my $rkey = $reskey->key('submit', { nostate => 1 }); Modified: slashjp/trunk/plugins/Journal/mysql_schema =================================================================== --- slashjp/trunk/plugins/Journal/mysql_schema 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/plugins/Journal/mysql_schema 2007-11-02 07:59:46 UTC (rev 239) @@ -13,10 +13,14 @@ tid SMALLINT UNSIGNED NOT NULL, promotetype ENUM ("publicize","publish", "post") NOT NULL DEFAULT "publish", last_update timestamp NOT NULL, + srcid_32 BIGINT UNSIGNED NOT NULL DEFAULT 0, + srcid_24 BIGINT UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY (id), KEY uid_date_id (uid,date,id), KEY IDandUID (id,uid), - KEY tid (tid) + KEY tid (tid), + KEY srcid_32 (srcid_32), + KEY srcid_24 (srcid_24) ); DROP TABLE IF EXISTS journals_text; Modified: slashjp/trunk/plugins/Login/login.pl =================================================================== --- slashjp/trunk/plugins/Login/login.pl 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/plugins/Login/login.pl 2007-11-02 07:59:46 UTC (rev 239) @@ -250,9 +250,7 @@ @srcids{keys %{$user->{srcids}}} = values %{$user->{srcids}}; delete $srcids{uid}; - if ($reader->checkAL2(\%srcids, 'nopost') - || $reader->checkAL2(\%srcids, 'nopostanon') - ) { + if ($reader->checkAL2(\%srcids, [qw( nopost nopostanon spammer )])) { push @note, getData('mail_readonly'); $error = 1; Modified: slashjp/trunk/plugins/Metamod/templates/dispTheComments;metamod;default =================================================================== --- slashjp/trunk/plugins/Metamod/templates/dispTheComments;metamod;default 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/plugins/Metamod/templates/dispTheComments;metamod;default 2007-11-02 07:59:46 UTC (rev 239) @@ -21,8 +21,8 @@ [% STOP %] [% END %] [% user.noscores = 1; # Do not show scores in comment display. %] -PLEASE READ THE DIRECTIONS CAREFULLY BEFORE EMAILING -[% constants.siteadmin_name.uc %]!

What follows are random +PLEASE READ THE DIRECTIONS CAREFULLY BEFORE EMAILING US! +

What follows are random moderations performed on comments in the last few weeks on [% constants.sitename %]. You are asked to honestly evaluate the actions of the moderator of each comment. Moderators who are ranked poorly will cease to be eligible for Added: slashjp/trunk/plugins/ResKey/ResKey/Checks/AL2/Spammer.pm =================================================================== --- slashjp/trunk/plugins/ResKey/ResKey/Checks/AL2/Spammer.pm 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/plugins/ResKey/ResKey/Checks/AL2/Spammer.pm 2007-11-02 07:59:46 UTC (rev 239) @@ -0,0 +1,24 @@ +# 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: $ + +package Slash::ResKey::Checks::AL2::Spammer; + +use warnings; +use strict; + +use Slash::ResKey::Checks::AL2; +use Slash::Utility; +use Slash::Constants ':reskey'; + +use base 'Slash::ResKey::Key'; + +our($VERSION) = ' $Revision: $ ' =~ /\$Revision:\s+([^\s]+)/; + +sub doCheck { + my($self) = @_; + return AL2Check($self, 'spammer'); +} + +1; Modified: slashjp/trunk/plugins/ResKey/mysql_dump.sql =================================================================== --- slashjp/trunk/plugins/ResKey/mysql_dump.sql 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/plugins/ResKey/mysql_dump.sql 2007-11-02 07:59:46 UTC (rev 239) @@ -52,6 +52,7 @@ 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); INSERT INTO reskey_resource_checks VALUES (NULL, 1, 'use', 'Slash::ResKey::Checks::ProxyScan', 1001); @@ -78,6 +79,7 @@ INSERT INTO reskey_resource_checks VALUES (NULL, 2, 'all', 'Slash::ResKey::Checks::AL2::AnonNoPost', 301); INSERT INTO reskey_resource_checks VALUES (NULL, 2, 'all', 'Slash::ResKey::Checks::AL2::NoPostAnon', 401); INSERT INTO reskey_resource_checks VALUES (NULL, 2, 'all', 'Slash::ResKey::Checks::AL2::NoPost', 501); +INSERT INTO reskey_resource_checks VALUES (NULL, 2, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); INSERT INTO reskey_resource_checks VALUES (NULL, 2, 'all', 'Slash::ResKey::Checks::Duration', 601); ### vars @@ -101,6 +103,7 @@ INSERT INTO reskey_resource_checks VALUES (NULL, 3, 'all', 'Slash::ResKey::Checks::AL2::AnonNoPost', 301); INSERT INTO reskey_resource_checks VALUES (NULL, 3, 'all', 'Slash::ResKey::Checks::AL2::NoPostAnon', 401); INSERT INTO reskey_resource_checks VALUES (NULL, 3, 'all', 'Slash::ResKey::Checks::AL2::NoPost', 501); +INSERT INTO reskey_resource_checks VALUES (NULL, 3, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); INSERT INTO reskey_resource_checks VALUES (NULL, 3, 'all', 'Slash::ResKey::Checks::Duration', 601); ### vars @@ -120,6 +123,7 @@ INSERT INTO reskey_resource_checks VALUES (NULL, 4, 'all', 'Slash::ResKey::Checks::AL2::AnonNoPost', 301); INSERT INTO reskey_resource_checks VALUES (NULL, 4, 'all', 'Slash::ResKey::Checks::AL2::NoPostAnon', 401); INSERT INTO reskey_resource_checks VALUES (NULL, 4, 'all', 'Slash::ResKey::Checks::AL2::NoPost', 501); +INSERT INTO reskey_resource_checks VALUES (NULL, 4, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); INSERT INTO reskey_resource_checks VALUES (NULL, 4, 'all', 'Slash::ResKey::Checks::Duration', 601); ### vars @@ -157,6 +161,7 @@ INSERT INTO reskey_resource_checks VALUES (NULL, 5, 'all', 'Slash::ResKey::Checks::AL2::AnonNoPost', 301); INSERT INTO reskey_resource_checks VALUES (NULL, 5, 'all', 'Slash::ResKey::Checks::AL2::NoPostAnon', 401); INSERT INTO reskey_resource_checks VALUES (NULL, 5, 'all', 'Slash::ResKey::Checks::AL2::NoPost', 501); +INSERT INTO reskey_resource_checks VALUES (NULL, 5, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); INSERT INTO reskey_resource_checks VALUES (NULL, 5, 'all', 'Slash::ResKey::Checks::Duration', 601); ### vars @@ -177,6 +182,7 @@ INSERT INTO reskey_resource_checks VALUES (NULL, 6, 'all', 'Slash::ResKey::Checks::AL2::AnonNoPost', 301); INSERT INTO reskey_resource_checks VALUES (NULL, 6, 'all', 'Slash::ResKey::Checks::AL2::NoPostAnon', 401); INSERT INTO reskey_resource_checks VALUES (NULL, 6, 'all', 'Slash::ResKey::Checks::AL2::NoPost', 501); +INSERT INTO reskey_resource_checks VALUES (NULL, 6, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); INSERT INTO reskey_resource_checks VALUES (NULL, 6, 'all', 'Slash::ResKey::Checks::AL2::NoSubmit', 551); INSERT INTO reskey_resource_checks VALUES (NULL, 6, 'all', 'Slash::ResKey::Checks::Duration', 601); @@ -198,6 +204,7 @@ INSERT INTO reskey_resource_checks VALUES (NULL, 9, 'all', 'Slash::ResKey::Checks::AL2::AnonNoPost', 301); INSERT INTO reskey_resource_checks VALUES (NULL, 9, 'all', 'Slash::ResKey::Checks::AL2::NoPostAnon', 401); INSERT INTO reskey_resource_checks VALUES (NULL, 9, 'all', 'Slash::ResKey::Checks::AL2::NoPost', 501); +INSERT INTO reskey_resource_checks VALUES (NULL, 9, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); INSERT INTO reskey_resource_checks VALUES (NULL, 9, 'use', 'Slash::ResKey::Checks::Moderate', 601); ### vars @@ -219,7 +226,7 @@ INSERT INTO reskey_resource_checks VALUES (NULL, 10, 'all', 'Slash::ResKey::Checks::ACL', 201); INSERT INTO reskey_resource_checks VALUES (NULL, 10, 'all', 'Slash::ResKey::Checks::AL2::AnonNoPost', 301); INSERT INTO reskey_resource_checks VALUES (NULL, 10, 'all', 'Slash::ResKey::Checks::AL2::NoPostAnon', 401); -INSERT INTO reskey_resource_checks VALUES (NULL, 10, 'all', 'Slash::ResKey::Checks::AL2::NoPost', 501); +INSERT INTO reskey_resource_checks VALUES (NULL, 10, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); INSERT INTO reskey_resource_checks VALUES (NULL, 10, 'all', 'Slash::ResKey::Checks::AL2::NoSubmit', 551); INSERT INTO reskey_resource_checks VALUES (NULL, 10, 'all', 'Slash::ResKey::Checks::Duration', 601); Modified: slashjp/trunk/plugins/Tags/Tags.pm =================================================================== --- slashjp/trunk/plugins/Tags/Tags.pm 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/plugins/Tags/Tags.pm 2007-11-02 07:59:46 UTC (rev 239) @@ -11,7 +11,7 @@ use Slash::Display; use Slash::Utility; use Slash::DB::Utility; -use Slash::Clout; +#use Slash::Clout; use Apache::Cookie; use vars qw($VERSION); use base 'Slash::DB::Utility'; Modified: slashjp/trunk/plugins/Tags/templates/tagsstorydivadmin;misc;default =================================================================== --- slashjp/trunk/plugins/Tags/templates/tagsstorydivadmin;misc;default 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/plugins/Tags/templates/tagsstorydivadmin;misc;default 2007-11-02 07:59:46 UTC (rev 239) @@ -16,7 +16,7 @@ [% IF user.is_admin %] [% PROCESS ajax_reskey_tag reskey_label => 'admin_commands-reskey-' _ sidenc, reskey_name => 'ajax_admin' %] - + [History]

[% tags_admin_str %]
Modified: slashjp/trunk/plugins/Tags/templates/tagsurldivadmin;misc;default =================================================================== --- slashjp/trunk/plugins/Tags/templates/tagsurldivadmin;misc;default 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/plugins/Tags/templates/tagsurldivadmin;misc;default 2007-11-02 07:59:46 UTC (rev 239) @@ -16,7 +16,7 @@ [% IF user.is_admin %] [% PROCESS ajax_reskey_tag reskey_label => 'admin_commands-reskey-' _ id, reskey_name => 'ajax_admin' %] - + [History]
[% tags_admin_str %]
Modified: slashjp/trunk/sql/mysql/defaults.sql =================================================================== --- slashjp/trunk/sql/mysql/defaults.sql 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/sql/mysql/defaults.sql 2007-11-02 07:59:46 UTC (rev 239) @@ -25,6 +25,7 @@ INSERT INTO al2_types VALUES (8, 6, 'trusted', 'Trusted'); INSERT INTO al2_types VALUES (9, 7, 'proxy', 'Valid Proxy'); INSERT INTO al2_types VALUES (10, 8, 'nopostanon', 'No Comment Post Anon'); +INSERT INTO al2_types VALUES (11, 9, 'binspam', 'Binspammer'); # @@ -830,7 +831,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_181','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_182','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/trunk/sql/mysql/slashschema_create.sql =================================================================== --- slashjp/trunk/sql/mysql/slashschema_create.sql 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/sql/mysql/slashschema_create.sql 2007-11-02 07:59:46 UTC (rev 239) @@ -1065,13 +1065,14 @@ # -# Table structure for table 'story_static_files' +# Table structure for table 'static_files' # -DROP TABLE IF EXISTS story_static_files; +DROP TABLE IF EXISTS static_files; CREATE TABLE story_static_files( sfid mediumint unsigned NOT NULL auto_increment, stoid mediumint unsigned NOT NULL, + fhid mediumint unsigned NOT NULL, filetype ENUM("file", "image", "audio") not null default "file", name varchar(255) default '' NOT NULL, width smallint unsigned not null default 0, Modified: slashjp/trunk/sql/mysql/upgrades =================================================================== --- slashjp/trunk/sql/mysql/upgrades 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/sql/mysql/upgrades 2007-11-02 07:59:46 UTC (rev 239) @@ -4916,17 +4916,16 @@ # For tagboxes/Top INSERT INTO tagbox_userkeyregexes VALUES ('Top', '^tag_clout$'); - CREATE TABLE file_queue ( fqid int(10) unsigned NOT NULL auto_increment, stoid mediumint(8) unsigned default NULL, fhid mediumint(8) unsigned default NULL, file varchar(255) default NULL, action enum('upload','thumbnails') default NULL, - PRIMARY KEY (fqid) + PRIMARY KEY (fqid) ) ENGINE=InnoDB; -CREATE TABLE story_static_files( +CREATE TABLE story_static_files ( sfid mediumint unsigned NOT NULL auto_increment, stoid mediumint unsigned NOT NULL, filetype ENUM("file", "image", "audio") not null default "file", @@ -4935,12 +4934,9 @@ INDEX stoid(stoid) ) ENGINE=InnoDB; - # 2007-10-16 UPDATE vars SET value = 'T_2_5_0_180' WHERE name = 'cvs_tag_currentcode'; -# SLASHDOT LAST UPDATED HERE - INSERT INTO string_param (type, code, name) VALUES ('mediatypes','none','None'); INSERT INTO string_param (type, code, name) VALUES ('mediatypes','video','Video'); INSERT INTO string_param (type, code, name) VALUES ('mediatypes','image','Image'); @@ -4964,7 +4960,45 @@ # 2007-10-25 UPDATE vars SET value = 'T_2_5_0_181' WHERE name = 'cvs_tag_currentcode'; +# PUDGE LAST UPDATED HERE + +# For plugins/FireHose +# Install CPAN module File::Type for plugins/FireHose +ALTER TABLE firehose_text ADD COLUMN media TEXT; +ALTER TABLE firehose ADD thumb MEDIUMINT UNSIGNED; + +RENAME TABLES story_static_files to static_files; +ALTER TABLE static_files ADD COLUMN fhid mediumint unsigned NOT NULL; + +# for plugins/Journal +ALTER TABLE journals ADD COLUMN srcid_32 BIGINT UNSIGNED NOT NULL DEFAULT 0, ADD COLUMN srcid_24 BIGINT UNSIGNED NOT NULL DEFAULT 0; +ALTER TABLE journals ADD INDEX srcid_32 (srcid_32), ADD INDEX srcid_24 (srcid_24); + +# for plugins/Bookmark +ALTER TABLE bookmarks ADD COLUMN srcid_32 BIGINT UNSIGNED NOT NULL DEFAULT 0, ADD COLUMN srcid_24 BIGINT UNSIGNED NOT NULL DEFAULT 0; +ALTER TABLE bookmarks ADD INDEX srcid_32 (srcid_32), ADD INDEX srcid_24 (srcid_24); +INSERT INTO reskey_resource_checks VALUES (NULL, 8, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); + +SELECT @maxbitpos := MAX(bitpos) FROM al2_types; +INSERT INTO al2_types VALUES (NULL, @maxbitpos+1, 'spammer', 'Spammer'); + +INSERT INTO reskey_resource_checks VALUES (NULL, 1, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); +INSERT INTO reskey_resource_checks VALUES (NULL, 2, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); +INSERT INTO reskey_resource_checks VALUES (NULL, 3, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); +INSERT INTO reskey_resource_checks VALUES (NULL, 4, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); +INSERT INTO reskey_resource_checks VALUES (NULL, 5, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); +INSERT INTO reskey_resource_checks VALUES (NULL, 6, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); +INSERT INTO reskey_resource_checks VALUES (NULL, 9, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); +INSERT INTO reskey_resource_checks VALUES (NULL,10, 'all', 'Slash::ResKey::Checks::AL2::Spammer', 531); + +# For tagboxes/Top +INSERT IGNORE INTO vars (name, value, description) VALUES ('tagbox_top_excludetagnames', 'yes no binspam dupe notthebest offtopic stupid slownewsday interesting funny insightful', 'Minimum score a tag must have to make it into the top tags for a story or firehose item'); + + +# 2007-11-01 +UPDATE vars SET value = 'T_2_5_0_182' WHERE name = 'cvs_tag_currentcode'; + # SLASHCODE/USEPERL LAST UPDATED HERE -# PUDGE LAST UPDATED HERE +# SLASHDOT LAST UPDATED HERE Added: slashjp/trunk/tagboxes/Despam/Despam.pm =================================================================== --- slashjp/trunk/tagboxes/Despam/Despam.pm 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/tagboxes/Despam/Despam.pm 2007-11-02 07:59:46 UTC (rev 239) @@ -0,0 +1,264 @@ +#!/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: $ + +package Slash::Tagbox::Despam; + +=head1 NAME + +Slash::Tagbox::Despam - Reduce (firehose) spam + +=head1 SYNOPSIS + + my $tagbox_tcu = getObject("Slash::Tagbox::Despam"); + my $feederlog_ar = $tagbox_tcu->feed_newtags($users_ar); + $tagbox_tcu->run($affected_globjid); + +=cut + +use strict; + +use Slash; +use Slash::DB; +use Slash::Utility::Environment; +use Slash::Tagbox; + +use Data::Dumper; + +use vars qw( $VERSION ); +$VERSION = ' $Revision: $ ' =~ /\$Revision:\s+([^\s]+)/; + +use base 'Slash::DB::Utility'; # first for object init stuff, but really + # needs to be second! figure it out. -- pudge +use base 'Slash::DB::MySQL'; + +sub new { + my($class, $user) = @_; + + return undef if !$class->isInstalled(); + + # Note that getTagboxes() would call back to this new() function + # if the tagbox objects have not yet been created -- but the + # no_objects option prevents that. See getTagboxes() for details. + my($tagbox_name) = $class =~ /(\w+)$/; + my %self_hash = %{ getObject('Slash::Tagbox')->getTagboxes($tagbox_name, undef, { no_objects => 1 }) }; + my $self = \%self_hash; + return undef if !$self || !keys %$self; + + bless($self, $class); + $self->{virtual_user} = $user; + $self->sqlConnect(); + + my $constants = getCurrentStatic(); + my $tagsdb = getObject('Slash::Tags'); + $self->{spamid} = $tagsdb->getTagnameidCreate('binspam'); + $self->{upvoteid} = $tagsdb->getTagnameidCreate($constants->{tags_upvote_tagname} || 'nod'); + return undef unless $self->{spamid}; + + return $self; +} + +sub isInstalled { + my($class) = @_; + my $constants = getCurrentStatic(); + my($tagbox_name) = $class =~ /(\w+)$/; + return $constants->{plugin}{Tags} && $constants->{tagbox}{$tagbox_name} || 0; +} + +sub feed_newtags { + my($self, $tags_ar) = @_; + my $constants = getCurrentStatic(); + if (scalar(@$tags_ar) < 9) { + main::tagboxLog("Despam->feed_newtags called for tags '" . join(' ', map { $_->{tagid} } @$tags_ar) . "'"); + } else { + main::tagboxLog("Despam->feed_newtags called for " . scalar(@$tags_ar) . " tags " . $tags_ar->[0]{tagid} . " ... " . $tags_ar->[-1]{tagid}); + } + + # The algorithm of the importance of tags to this tagbox is simple + # (at least for now). 'binspam' from an admin on a firehose item + # is important. Other tags are not. + my $slashdb = getCurrentDB(); + my $admins = $slashdb->getAdmins(); + + my $ret_ar = [ ]; + for my $tag_hr (@$tags_ar) { + next unless $tag_hr->{tagnameid} == $self->{spamid} && $admins->{ $tag_hr->{uid} }; + my $ret_hr = { + affected_id => $tag_hr->{globjid}, + importance => 1, + }; + # We identify this little chunk of importance by either + # tagid or tdid depending on whether the source data had + # the tdid field (which tells us whether feed_newtags was + # "really" called via feed_deactivatedtags). + if ($tag_hr->{tdid}) { $ret_hr->{tdid} = $tag_hr->{tdid} } + else { $ret_hr->{tagid} = $tag_hr->{tagid} } + push @$ret_ar, $ret_hr; + } + return [ ] if !@$ret_ar; + + # Tags applied to globjs that have a firehose entry associated + # are important. Other tags are not. + my %globjs = ( map { $_->{affected_id}, 1 } @$ret_ar ); + my $globjs_str = join(', ', sort keys %globjs); + my $fh_globjs_ar = $self->sqlSelectColArrayref( + 'globjid', + 'firehose', + "globjid IN ($globjs_str)"); + 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 ]; + + main::tagboxLog("Despam->feed_newtags returning " . scalar(@$ret_ar)); + return $ret_ar; +} + +sub feed_deactivatedtags { + my($self, $tags_ar) = @_; + main::tagboxLog("Despam->feed_deactivatedtags called: tags_ar='" . join(' ', map { $_->{tagid} } @$tags_ar) . "'"); + my $ret_ar = $self->feed_newtags($tags_ar); + main::tagboxLog("Despam->feed_deactivatedtags returning " . scalar(@$ret_ar)); + return $ret_ar; +} + +sub feed_userchanges { + my($self, $users_ar) = @_; + main::tagboxLog("Despam->feed_userchanges called (oddly): users_ar='" . join(' ', map { $_->{tuid} } @$users_ar) . "'"); + return [ ]; +} + +sub run { + my($self, $affected_id, $options) = @_; + my $constants = getCurrentStatic(); + my $tagsdb = getObject('Slash::Tags'); + my $tagboxdb = getObject('Slash::Tagbox'); + my $firehose_db = getObject('Slash::FireHose'); + + 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 $fhitem = $firehose_db->getFireHose($fhid); + my $submitter_uid = $fhitem->{uid}; + + my $admins = $tagsdb->getAdmins(); + my $admin_in_str = join(',', + sort { $a <=> $b } + grep { $admins->{$_}{seclev} >= 100 } + keys %$admins); + return unless $admin_in_str; + + my $slashdb = getCurrentStatic(); + 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"); + if ($binspam_count > $constants->{tagbox_despam_binspamsallowed}) { + main::tagboxLog(sprintf("%s->run marking uid %d for %d admin binspam tags, latest %d (%d)", + ref($self), $submitter_uid, $binspam_count, $fhid, $affected_id)); + $self->despam_uid($submitter_uid, $binspam_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. + $slashdb->setAL2($uid, { spammer => 1, comment => "Despam $count" }); + + # Next, set the user's clout manually to 0. + $slashdb->setUser($uid, { tag_clout => 0 }); + + # Next, if $count is high enough, set the 'spammer' AL2 for all + # the IPID's the user has submitted from. + 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)"); + my $journal_srcid_ar = $reader->sqlSelectColArrayref( + 'DISTINCT ' . get_srcid_sql_out('srcid_32'), + 'journals', + "uid=$uid AND date >= DATE_SUB(NOW(), INTERVAL $days DAY)"); + my $book_srcid_ar = $reader->sqlSelectColArrayref( + 'DISTINCT ' . get_srcid_sql_out('srcid_32'), + 'bookmarks', + "uid=$uid AND time >= DATE_SUB(NOW(), INTERVAL $days DAY)"); + 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 keys %srcid_used; + for my $srcid (@srcids) { + $slashdb->setAL2($srcid, { spammer => 1, comment => "Despam $count" }); + } + } + + # Next, reject everything the user's submitted. + $slashdb->sqlUpdate('firehose', { rejected => 'yes' }, + "accepted != 'no' AND uid=$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}"); + my $max_clout = defined($constants->{tagbox_despam_upvotermaxclout}) + ? $constants->{tagbox_despam_upvotermaxclout} : '0.85'; + for my $upvoter (@$upvoter_ar) { +print STDERR "Despam setting user $upvoter clout to $max_clout\n"; + $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 }, + }); + } + } + sleep 10; +} + +1; + Added: slashjp/trunk/tagboxes/Despam/Makefile.PL =================================================================== --- slashjp/trunk/tagboxes/Despam/Makefile.PL 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/tagboxes/Despam/Makefile.PL 2007-11-02 07:59:46 UTC (rev 239) @@ -0,0 +1,9 @@ +use ExtUtils::MakeMaker; +# See lib/ExtUtils/MakeMaker.pm for details of how to influence +# the contents of the Makefile that is written. +# $Id: $ +WriteMakefile( + 'NAME' => 'Slash::Tagbox::Despam', + 'VERSION_FROM' => 'Despam.pm', # finds $VERSION + 'PM' => { 'Despam.pm' => '$(INST_LIBDIR)/Despam.pm' }, +); Added: slashjp/trunk/tagboxes/Despam/TAGBOX =================================================================== --- slashjp/trunk/tagboxes/Despam/TAGBOX 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/tagboxes/Despam/TAGBOX 2007-11-02 07:59:46 UTC (rev 239) @@ -0,0 +1,4 @@ +# $Id: $ +name=Despam +description=Reduce (firehose) spam +mysql_dump=mysql_dump.sql Added: slashjp/trunk/tagboxes/Despam/mysql_dump.sql =================================================================== --- slashjp/trunk/tagboxes/Despam/mysql_dump.sql 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/tagboxes/Despam/mysql_dump.sql 2007-11-02 07:59:46 UTC (rev 239) @@ -0,0 +1,5 @@ +# $Id: $ +INSERT INTO tagboxes (tbid, name, affected_type, clid, weight, last_run_completed, last_tagid_logged, last_tdid_logged, last_tuid_logged) VALUES (NULL, 'Despam', 'globj', 1, 1, '2000-01-01 00:00:00', 0, 0, 0); +INSERT IGNORE INTO vars (name, value, description) VALUES ('tagbox_despam_binspamsallowed', '1', 'Number of binspam tags allowed before action is taken'); +INSERT IGNORE INTO vars (name, value, description) VALUES ('tagbox_despam_ipdayslookback', '60', 'Number of days to look back in tables to mark IPs, 0 disables IP marking'); +INSERT IGNORE INTO vars (name, value, description) VALUES ('tagbox_despam_upvotermaxclout', '0.85', 'Maximum tag_clout for any user who upvotes a submission from a spammer user'); Modified: slashjp/trunk/tagboxes/Top/Top.pm =================================================================== --- slashjp/trunk/tagboxes/Top/Top.pm 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/tagboxes/Top/Top.pm 2007-11-02 07:59:46 UTC (rev 239) @@ -200,6 +200,16 @@ $a cmp $b } keys %scores; + # Eliminate tagnames in a given list, and their opposites. + my %nontop = ( map { ($_, 1) } + grep { $_ } + map { ($_, $tags_reader->getOppositeTagname($_)) } + split / /, ($constants->{tagbox_top_excludetagnames} || '') + ); + # Eliminate tagnames that are just the author's name. + my @names = map { lc } @{ $tags_reader->getAuthorNames() }; + for my $name (@names) { $nontop{$name} = 1 } + # Eliminate tagnames below the minimum score required, and # those that didn't make it to the top 5 # XXX the "4" below (aka "top 5") is hardcoded currently, should be a var @@ -212,7 +222,8 @@ my $fhid = $firehose->getFireHoseIdFromGlobjid($affected_id); my @top = ( ); if ($fhid) { - @top = grep { $scores{$_} >= $minscore1 } + @top = grep { $scores{$_} >= $minscore1 } + grep { !$nontop{$_} } sort { $scores{$b} <=> $scores{$a} || @@ -227,6 +238,7 @@ if ($type eq 'stories') { my @top = grep { $scores{$_} >= $minscore2 } + grep { !$nontop{$_} } sort { $scores{$b} <=> $scores{$a} || Modified: slashjp/trunk/tagboxes/Top/mysql_dump.sql =================================================================== --- slashjp/trunk/tagboxes/Top/mysql_dump.sql 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/tagboxes/Top/mysql_dump.sql 2007-11-02 07:59:46 UTC (rev 239) @@ -4,6 +4,7 @@ INSERT IGNORE INTO vars (name, value, description) VALUES ('tagbox_top_minscore_stories', '2', 'Minimum score a tag must have to make it into the top tags for a story'); INSERT IGNORE INTO vars (name, value, description) VALUES ('tagbox_top_minscore_urls', '2', 'Minimum score a tag must have to make it into the top tags for a URL'); +INSERT IGNORE INTO vars (name, value, description) VALUES ('tagbox_top_excludetagnames', 'yes no binspam dupe notthebest offtopic stupid slownewsday interesting funny insightful', 'Minimum score a tag must have to make it into the top tags for a story or firehose item'); INSERT INTO tagbox_userkeyregexes VALUES ('Top', '^tag_clout$'); Modified: slashjp/trunk/themes/slashcode/htdocs/comments.css =================================================================== --- slashjp/trunk/themes/slashcode/htdocs/comments.css 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/themes/slashcode/htdocs/comments.css 2007-11-02 07:59:46 UTC (rev 239) @@ -144,10 +144,6 @@ } .newcomment { } -.currcomment { - opacity: .50; - filter: alpha(opacity=50); -} .comment > .hidden { display: none; @@ -171,6 +167,10 @@ overflow: hidden; } +.comment > .currcomment { + border: 1px dotted #666; +} + /* lots of space between lines */ .comment > .oneline .commentTop, .comment > .oneline .commentBody { border: none; Modified: slashjp/trunk/themes/slashcode/htdocs/images/comments.js =================================================================== --- slashjp/trunk/themes/slashcode/htdocs/images/comments.js 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/themes/slashcode/htdocs/images/comments.js 2007-11-02 07:59:46 UTC (rev 239) @@ -29,6 +29,7 @@ var commentelements = {}; var thresh_totals = {}; +var ajaxCommentsWaitQueue = []; var boxStatusQueue = []; var comment_body_reply = []; var root_comment = 0; @@ -652,6 +653,9 @@ if (cids && !cids.length) return; + if (!cids && ajaxCommentsWait()) + return; + if (option) thresh = 1; @@ -699,7 +703,7 @@ var response = eval_response(transport); if (!response) { - boxStatus(0); + ajaxCommentsStatus(0); return; } @@ -766,8 +770,6 @@ if (this_id) this_id.className = this_id.className.replace(' newcomment', ' oldcomment'); } - last_updated_comments = []; - last_updated_comments_index = -1; } for (var i = 0; i < update.new_cids_order.length; i++) { @@ -808,9 +810,9 @@ updateHiddens(cids); if (do_update && highlight && last_updated_comments.length) { last_updated_comments_index = last_updated_comments_index + 1; - setFocusComment(last_updated_comments[0], 1); + setFocusComment(last_updated_comments[last_updated_comments_index], 1); } - boxStatus(0); + ajaxCommentsStatus(0); if (0 && adTimerInsert) { var tree = $('tree_' + adTimerInsert); @@ -828,7 +830,7 @@ } }; - boxStatus(1); + ajaxCommentsStatus(1); ajax_update(params, '', handlers); if (cids) { @@ -1082,6 +1084,21 @@ } } +function ajaxCommentsWait() { + return ajaxCommentsWaitQueue.length ? 1 : 0; +} + +function ajaxCommentsStatus(bool) { + boxStatus(bool); + + if (bool) + ajaxCommentsWaitQueue.push(1); + else + ajaxCommentsWaitQueue.shift(); + + return true; +} + function boxStatus(bool) { var box = $('commentControlBoxStatus'); if (bool) { @@ -1647,19 +1664,25 @@ function setCurrentComment (cid) { + var this_id; if (current_cid) { - var this_id = fetchEl('comment_top_' + current_cid); - if (this_id) { + if (cid == current_cid) + return; + + this_id = fetchEl('comment_top_' + current_cid); + if (this_id) this_id.className = this_id.className.replace(' newcomment', ' oldcomment'); + + this_id = fetchEl('comment_' + current_cid); + if (this_id) this_id.className = this_id.className.replace(' currcomment', ''); - } } - var this_id = fetchEl('comment_top_' + cid); - if (this_id) { + this_id = fetchEl('comment_' + cid); + if (this_id) this_id.className = this_id.className + ' currcomment'; - } + current_cid = cid; } @@ -1682,12 +1705,15 @@ var update = 0; if (key == 'J' || key == 'S') { update = 1; - if (i <= 0) - i = l; - else + if (i <= 0) { + // this did go back to end; nothing, for now + //i = l; + } else i = i - 1; } else if (key == 'K' || key == 'W') { if (i >= l) { + if (ajaxCommentsWait()) + return; update = 2; ajaxFetchComments(0, 1, '', 1); } else { Modified: slashjp/trunk/themes/slashcode/htdocs/users.pl =================================================================== --- slashjp/trunk/themes/slashcode/htdocs/users.pl 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/themes/slashcode/htdocs/users.pl 2007-11-02 07:59:46 UTC (rev 239) @@ -696,10 +696,11 @@ # user, to determine whether this IP is OK'd to # send the mail to the target user. # XXXSRCID This should check a separate field like - # 'openproxy' instead of piggybacking off of 'nopost' + # 'openproxy' instead of piggybacking off of the + # existing nopost and spammer my $srcids_to_check = $user->{srcids}; $err_name = 'mailpasswd_readonly_err' - if $reader->checkAL2($srcids_to_check, 'nopost'); + if $reader->checkAL2($srcids_to_check, [qw( nopost spammer )]); } if (!$err_name) { $err_name = 'mailpasswd_toooften_err' @@ -3179,7 +3180,7 @@ sub listReadOnly { my $reader = getObject('Slash::DB', { db_type => 'reader' }); - my $readonlylist = $reader->getAL2List('nopost'); + my $readonlylist = $reader->getAL2List([qw( nopost spammer )]); slashDisplay('listReadOnly', { readonlylist => $readonlylist, Modified: slashjp/trunk/themes/slashcode/tasks/process_file_queue.pl =================================================================== --- slashjp/trunk/themes/slashcode/tasks/process_file_queue.pl 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/themes/slashcode/tasks/process_file_queue.pl 2007-11-02 07:59:46 UTC (rev 239) @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/local/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/. @@ -29,10 +29,13 @@ $file_queue_cmds = $slashdb->getNextFileQueueCmds(); } $cmd = shift @$file_queue_cmds; - if ($cmd->{blobid}) { - $cmd->{file} = blobToFile($cmd->{blobid}); - } - if($cmd) { + if ($cmd) { + if ($cmd->{blobid}) { + $cmd->{file} = blobToFile($cmd->{blobid}); + } + if ($cmd->{action} eq 'upload' && $cmd->{file} =~ /\.(jpg|gif|png)/i) { + $cmd->{action} = "thumbnails"; + } handleFileCmd($cmd); } last if $task_exit_flag; @@ -55,20 +58,29 @@ my $thumb = $namebase . "-thumb." . $suffix; my $thumbsm = $namebase . "-thumbsm." . $suffix; slashdLog("About to create thumb $path$thumb"); - system("convert -size 100x100 $path$name $path$thumb"); + system("/usr/bin/convert -size 260x194 $path$name -resize '130x97>' -bordercolor transparent -border 48 -gravity center -crop 130x97+0+0 -page +0+0 $path$thumb"); my $data = { - stoid => $cmd->{stoid}, - name => $thumb + stoid => $cmd->{stoid} || 0, + fhid => $cmd->{fhid} || 0 , + name => "$path$thumb" }; - addStoryFile($data, $path); + my $sfid = addFile($data); + if ($cmd->{fhid}) { + my $firehose = getObject("Slash::FireHose"); + if ($firehose) { + $firehose->setFireHose($cmd->{fhid}, { thumb => $sfid }); + } + } + slashdLog("About to create thumbsms $path$thumbsm"); - system("convert -size 50x50 $path$name $path$thumbsm"); + system("/usr/bin/convert -size 100x74 $path$name -resize '50x37>' -bordercolor transparent -border 18 -gravity center -crop 50x37+0+0 -page +0+0 $path$thumbsm"); $data = { - stoid => $cmd->{stoid}, - name => $thumbsm + stoid => $cmd->{stoid} || 0, + fhid => $cmd->{fhid} || 0, + name => "$path$thumbsm" }; - addStoryFile($data, $path); + addFile($data); } } if ($cmd->{action} eq "upload") { @@ -77,7 +89,7 @@ } $slashdb->deleteFileQueueCmd($cmd->{fqid}); if (verifyFileLocation($cmd->{file})) { - unlink $cmd->{file}; + # unlink $cmd->{file}; } } @@ -118,8 +130,10 @@ my($suffix) = $blob_ref->{filename} =~ /(\.\w+$)/; $suffix = lc($suffix); my ($ofh, $tmpname) = mkstemps("/tmp/upload/fileXXXXXX", $suffix ); + slashdLog("Writing file data to $tmpname\n"); print $ofh $blob_ref->{data}; close $ofh; + $blob->delete($blobid); return $tmpname; } @@ -144,11 +158,12 @@ push @files, $destfile if $destfile; my $name = fileparse($destfile); my $data = { - stoid => $cmd->{stoid}, - name => $name + stoid => $cmd->{stoid} || 0, + fhid => $cmd->{fhid} || 0, + name => "$destpath/$name" }; - addStoryFile($data, "$destpath/"); + addFile($data); } @@ -158,8 +173,18 @@ makeFileDir($destpath); my $numdir = sprintf("%09d",$cmd->{fhid}); my ($prefix) = $numdir =~ /\d\d\d\d\d\d(\d\d\d)/; - my $destfile = copyFileToLocation($cmd->{file}, $destpath, $prefix); - push @files, $destfile if $destfile; + if (verifyFileLocation($file)) { + my $destfile = copyFileToLocation($file, $destpath, $prefix); + my $name = fileparse($destfile); + push @files, $destfile if $destfile; + my $data = { + stoid => $cmd->{stoid} || 0, + fhid => $cmd->{fhid} || 0, + name => "$destpath/$name" + }; + slashdLog("Add firehose item: $data->{name}"); + addFile($data); + } } return \@files; } @@ -192,16 +217,16 @@ return $ret_val; } -sub addStoryFile { - my($data, $path) = @_; +sub addFile { + my($data) = @_; print "Add story file\n"; my $slashdb = getCurrentDB(); - slashdLog("addStoryFile $path $data->{name}"); - if ($data->{name} =~ /\.(png|gif|jpg)$/i && $path) { - ($data->{width}, $data->{height}) = imgsize("$path$data->{name}"); - slashdLog("addStoryFile $data->{width} $data->{height}"); + slashdLog("addFile $data->{name}"); + if ($data->{name} =~ /\.(png|gif|jpg)$/i) { + ($data->{width}, $data->{height}) = imgsize("$data->{name}"); + slashdLog("addFile $data->{width} $data->{height}"); } - $slashdb->addStoryStaticFile($data); + return $slashdb->addStaticFile($data); } 1; Modified: slashjp/trunk/themes/slashcode/templates/edit_comment;comments;default =================================================================== --- slashjp/trunk/themes/slashcode/templates/edit_comment;comments;default 2007-11-02 07:51:54 UTC (rev 238) +++ slashjp/trunk/themes/slashcode/templates/edit_comment;comments;default 2007-11-02 07:59:46 UTC (rev 239) @@ -156,8 +156,18 @@ Create an Account! [% END %] - +[% IF !user.is_anon && user.discussion2 && user.discussion2 == "slashdot"; + prefslink = "Customize Posting Preferences

 
"; + + prefslink; +END %] + [% IF !user.is_anon && user.karma > constants.goodkarma %] No Karma Bonus @@ -245,6 +255,14 @@

+ + + __seclev__ 1000 __version__ From svnnotify @ sourceforge.jp Fri Nov 2 17:01:54 2007 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Fri, 02 Nov 2007 17:01:54 +0900 Subject: [Slashdotjp-dev 730] [240] increase debian version to 2.5.0.182-0.1 Message-ID: <1193990514.186943.25037.nullmailer@users.sourceforge.jp> Revision: 240 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=240 Author: tach Date: 2007-11-02 17:01:53 +0900 (Fri, 02 Nov 2007) Log Message: ----------- increase debian version to 2.5.0.182-0.1 Modified Paths: -------------- slashjp/trunk/debian/changelog -------------- next part -------------- Modified: slashjp/trunk/debian/changelog =================================================================== --- slashjp/trunk/debian/changelog 2007-11-02 07:59:46 UTC (rev 239) +++ slashjp/trunk/debian/changelog 2007-11-02 08:01:53 UTC (rev 240) @@ -1,3 +1,9 @@ +slash (2.5.0.182-0.1) unstable; urgency=low + + * New upstream CVS release + + -- Taku YASUI Fri, 02 Nov 2007 17:00:48 +0900 + slash (2.5.0.181-0.1) unstable; urgency=low * New upstream CVS release From svnnotify @ sourceforge.jp Mon Nov 5 19:45:29 2007 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Mon, 05 Nov 2007 19:45:29 +0900 Subject: [Slashdotjp-dev 731] [242] fix deleteUser(), delete all slashdot related LDAP attributes Message-ID: <1194259529.645910.7886.nullmailer@users.sourceforge.jp> Revision: 242 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=242 Author: caesar Date: 2007-11-05 19:45:29 +0900 (Mon, 05 Nov 2007) Log Message: ----------- fix deleteUser(), delete all slashdot related LDAP attributes Modified Paths: -------------- slashjp/branches/deluser/Slash/LDAPDB/lib/Slash/LDAPDB.pm -------------- next part -------------- Modified: slashjp/branches/deluser/Slash/LDAPDB/lib/Slash/LDAPDB.pm =================================================================== --- slashjp/branches/deluser/Slash/LDAPDB/lib/Slash/LDAPDB.pm 2007-11-05 07:48:34 UTC (rev 241) +++ slashjp/branches/deluser/Slash/LDAPDB/lib/Slash/LDAPDB.pm 2007-11-05 10:45:29 UTC (rev 242) @@ -162,7 +162,9 @@ delete => [ objectClass => 'slashdotUserInfo', 'slashdotUidNumber', - 'slashdotEmail' + 'slashdotPassword', + 'slashdotEmail', + 'slashdotRealname' ] ]) }); } else { From svnnotify @ sourceforge.jp Thu Nov 8 15:57:54 2007 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Thu, 08 Nov 2007 15:57:54 +0900 Subject: [Slashdotjp-dev 732] [243] improve: check strictly for related story selection Message-ID: <1194505074.206757.31389.nullmailer@users.sourceforge.jp> Revision: 243 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=243 Author: tach Date: 2007-11-08 15:57:53 +0900 (Thu, 08 Nov 2007) Log Message: ----------- improve: check strictly for related story selection Modified Paths: -------------- slashjp/trunk/plugins/Admin/admin.pl -------------- next part -------------- Modified: slashjp/trunk/plugins/Admin/admin.pl =================================================================== --- slashjp/trunk/plugins/Admin/admin.pl 2007-11-05 10:45:29 UTC (rev 242) +++ slashjp/trunk/plugins/Admin/admin.pl 2007-11-08 06:57:53 UTC (rev 243) @@ -1586,7 +1586,7 @@ # my $regexsid = regexSid(); my $match = qr{(\d\d\/\d\d\/\d\d\/\d{6,})}; - my $match_cid = qr{/comments\.pl\?[^'"<>\s]*cid=(\d+)}; + my $match_cid = qr{/comments\.pl[^'"<>\s]*[?&;]cid=(\d+)}; if ($form->{add_related}) { my @add_related = split('\n', $form->{add_related}); From svnnotify @ sourceforge.jp Fri Nov 9 15:46:37 2007 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Fri, 09 Nov 2007 15:46:37 +0900 Subject: [Slashdotjp-dev 733] [244] merged from T_2_5_0_183 Message-ID: <1194590797.906507.21200.nullmailer@users.sourceforge.jp> Revision: 244 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=244 Author: tach Date: 2007-11-09 15:46:35 +0900 (Fri, 09 Nov 2007) Log Message: ----------- merged from T_2_5_0_183 Modified Paths: -------------- slashjp/branches/upstream/current/Slash/DB/MySQL/MySQL.pm slashjp/branches/upstream/current/Slash/Slash.pm slashjp/branches/upstream/current/Slash/Utility/Display/Display.pm slashjp/branches/upstream/current/plugins/Admin/admin.pl slashjp/branches/upstream/current/plugins/Admin/templates/editStory;admin;default slashjp/branches/upstream/current/plugins/Ajax/PLUGIN slashjp/branches/upstream/current/plugins/Ajax/htdocs/ajax.pl slashjp/branches/upstream/current/plugins/Ajax/templates/prefs_d2;ajax;default slashjp/branches/upstream/current/plugins/Bookmark/bookmark.pl slashjp/branches/upstream/current/plugins/Email/email.pl slashjp/branches/upstream/current/plugins/FireHose/mysql_dump.sql slashjp/branches/upstream/current/plugins/FireHose/mysql_schema.sql slashjp/branches/upstream/current/plugins/FireHose/templates/dispFireHose;firehose;default slashjp/branches/upstream/current/plugins/FireHose/templates/fhadvprefpane;misc;default slashjp/branches/upstream/current/plugins/FireHose/templates/firehose_options;misc;default slashjp/branches/upstream/current/plugins/Journal/Journal.pm slashjp/branches/upstream/current/plugins/Messages/DB/MySQL/MySQL.pm slashjp/branches/upstream/current/plugins/Messages/PLUGIN slashjp/branches/upstream/current/plugins/Tags/Tags.pm slashjp/branches/upstream/current/sql/mysql/defaults.sql slashjp/branches/upstream/current/sql/mysql/upgrades slashjp/branches/upstream/current/tagboxes/Despam/Despam.pm slashjp/branches/upstream/current/tagboxes/Despam/mysql_dump.sql slashjp/branches/upstream/current/tagboxes/FHEditorPop/FHEditorPop.pm slashjp/branches/upstream/current/tagboxes/FireHoseScores/FireHoseScores.pm slashjp/branches/upstream/current/tagboxes/Top/Top.pm slashjp/branches/upstream/current/themes/slashcode/htdocs/images/comments.js slashjp/branches/upstream/current/themes/slashcode/templates/edit_comment;comments;default slashjp/branches/upstream/current/themes/slashcode/templates/footer;misc;default slashjp/branches/upstream/current/themes/slashcode/templates/prefs_titlebar;misc;default slashjp/branches/upstream/current/themes/slashcode/templates/printCommentsMain;misc;default Added Paths: ----------- slashjp/branches/upstream/current/plugins/Ajax/templates/modal_footer;misc;default slashjp/branches/upstream/current/plugins/Ajax/templates/prefs_messages;ajax;default -------------- next part -------------- Modified: slashjp/branches/upstream/current/Slash/DB/MySQL/MySQL.pm =================================================================== --- slashjp/branches/upstream/current/Slash/DB/MySQL/MySQL.pm 2007-11-08 06:57:53 UTC (rev 243) +++ slashjp/branches/upstream/current/Slash/DB/MySQL/MySQL.pm 2007-11-09 06:46:35 UTC (rev 244) @@ -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: MySQL.pm,v 1.991 2007/11/01 20:35:18 jamiemccarthy Exp $ +# $Id: MySQL.pm,v 1.993 2007/11/07 23:15:22 jamiemccarthy Exp $ package Slash::DB::MySQL; use strict; @@ -20,7 +20,7 @@ use base 'Slash::DB::Utility'; use Slash::Constants ':messages'; -($VERSION) = ' $Revision: 1.991 $ ' =~ /\$Revision:\s+([^\s]+)/; +($VERSION) = ' $Revision: 1.993 $ ' =~ /\$Revision:\s+([^\s]+)/; # Fry: How can I live my life if I can't tell good from evil? @@ -5075,11 +5075,13 @@ # { norss => 0, trusted => 1, comment => 'we love these guys' }, # { adminuid => 78724 }); -# This method always succeeds. It returns 1 if a row was actually -# added to al2, 0 if there was merely an existing row that was updated. +# This method always succeeds unless srcid is 0. It returns +# 1 if a row was actually added to al2, 0 if there was merely an +# existing row that was updated. sub setAL2 { my($self, $srcid, $type_hr, $options) = @_; + return undef if !$srcid; my $adminuid = $options->{adminuid} || getCurrentUser('uid') || 0; my $ts_sql = $options->{ts} ? $self->sqlQuote($options->{ts}) : 'NOW()'; @@ -12140,6 +12142,8 @@ for my $id (@journal_ids) { my $globjid = $journals_hr->{$id}; my $fixnick = $journaldata_hr->{$id}{nickname}; +if (!defined $fixnick) { print STDERR scalar(gmtime) . " _addGlobjEssentials_journals no nick for journal $id\n"; } + $fixnick = fixparam($fixnick || ''); $data_hr->{$globjid}{url} = "$constants->{rootdir}/~$fixnick/journal/$id"; $data_hr->{$globjid}{title} = $journaldata_hr->{$id}{description}; $data_hr->{$globjid}{created_at} = $journaldata_hr->{$id}{date}; @@ -12492,6 +12496,20 @@ return $self->sqlSelectAllHashrefArray("*", "static_files", "stoid=$stoid_q"); } +sub getStaticFiles { + my($self, $stoid, $fhid) = @_; + my $stoid_q = $self->sqlQuote($stoid); + my $fhid_q = $self->sqlQuote($fhid); + my @where; + push @where, "stoid=$stoid_q"; + push @where, "fhid=$fhid_q"; + my $where = join ' OR ', @where; + print STDERR " $where \n"; + return $self->sqlSelectAllHashrefArray("*", "static_files", $where); +} + + + sub getStaticFile { my $answer = _genericGetCache({ table => 'static_files', Modified: slashjp/branches/upstream/current/Slash/Slash.pm =================================================================== --- slashjp/branches/upstream/current/Slash/Slash.pm 2007-11-08 06:57:53 UTC (rev 243) +++ slashjp/branches/upstream/current/Slash/Slash.pm 2007-11-09 06:46:35 UTC (rev 244) @@ -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: Slash.pm,v 1.340 2007/11/01 19:32:23 jamiemccarthy Exp $ +# $Id: Slash.pm,v 1.341 2007/11/02 14:26:40 jamiemccarthy Exp $ package Slash; @@ -1629,7 +1629,7 @@ $atstorytime = $constants->{subscribe_future_name}; } else { $atstorytime = $user->{aton} . ' ' - . timeCalc($story->{'time'}, $df, 0, { is_old => $is_old }); + . timeCalc($story->{'time'}, $df, undef, { is_old => $is_old }); } $return =~ s/\Q__TIME_TAG__\E/$atstorytime/; Modified: slashjp/branches/upstream/current/Slash/Utility/Display/Display.pm =================================================================== --- slashjp/branches/upstream/current/Slash/Utility/Display/Display.pm 2007-11-08 06:57:53 UTC (rev 243) +++ slashjp/branches/upstream/current/Slash/Utility/Display/Display.pm 2007-11-09 06:46:35 UTC (rev 244) @@ -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: Display.pm,v 1.124 2007/10/23 23:20:15 pudge Exp $ +# $Id: Display.pm,v 1.125 2007/11/08 08:52:57 pudge Exp $ package Slash::Utility::Display; @@ -33,7 +33,7 @@ use base 'Exporter'; use vars qw($VERSION @EXPORT); -($VERSION) = ' $Revision: 1.124 $ ' =~ /\$Revision:\s+([^\s]+)/; +($VERSION) = ' $Revision: 1.125 $ ' =~ /\$Revision:\s+([^\s]+)/; @EXPORT = qw( cleanSlashTags createMenu @@ -1347,7 +1347,7 @@ $display .= qq| by $linkdata->{nickname}|; $display .= qq| (Score:$linkdata->{points})| if !$user->{noscores} && $linkdata->{points}; - $display .= " " . timeCalc($linkdata->{date}) + $display .= " " . timeCalc($linkdata->{'time'}) if $linkdata->{date}; } #$display .= "\n"; @@ -1728,4 +1728,4 @@ =head1 VERSION -$Id: Display.pm,v 1.124 2007/10/23 23:20:15 pudge Exp $ +$Id: Display.pm,v 1.125 2007/11/08 08:52:57 pudge Exp $ Modified: slashjp/branches/upstream/current/plugins/Admin/admin.pl =================================================================== --- slashjp/branches/upstream/current/plugins/Admin/admin.pl 2007-11-08 06:57:53 UTC (rev 243) +++ slashjp/branches/upstream/current/plugins/Admin/admin.pl 2007-11-09 06:46:35 UTC (rev 244) @@ -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: admin.pl,v 1.324 2007/10/30 20:21:09 tvroom Exp $ +# $Id: admin.pl,v 1.326 2007/11/08 08:54:00 pudge Exp $ use strict; use File::Temp 'tempfile'; @@ -1241,6 +1241,11 @@ $display_check = $form->{display} ? $constants->{markup_checked_attribute} : ''; } + $stoid = $slashdb->getStory($form->{stoid} || $form->{sid}, 'stoid', 1); + if ($stoid) { + handleMediaFileForStory($stoid); + } + } elsif ($stoid) { # Loading an existing SID $user->{state}{editing} = 1; @@ -1517,7 +1522,9 @@ if ($stoid || $form->{sid}) { my $story = $slashdb->getStory($form->{sid}); $stoid ||= $story->{stoid}; - $pending_file_count = $slashdb->numPendingFilesForStory($stoid); $story_static_files = $slashdb->getStaticFilesForStory($stoid); + my $fhid = $form->{fhid} || $story->{fhid}; + $pending_file_count = $slashdb->numPendingFilesForStory($stoid); + $story_static_files = $slashdb->getStaticFiles($stoid, $fhid); } slashDisplay('editStory', { stoid => $stoid, Modified: slashjp/branches/upstream/current/plugins/Admin/templates/editStory;admin;default =================================================================== --- slashjp/branches/upstream/current/plugins/Admin/templates/editStory;admin;default 2007-11-08 06:57:53 UTC (rev 243) +++ slashjp/branches/upstream/current/plugins/Admin/templates/editStory;admin;default 2007-11-09 06:46:35 UTC (rev 244) @@ -244,11 +244,14 @@
[% ispell_comments.introtext %]
[% PROCESS editbuttons %] - + [% IF newarticle %] + Need to save the story before you can upload files to it
+ [% ELSE %] + [% END %] [% IF story_static_files && story_static_files.size %]