svnno****@sourc*****
svnno****@sourc*****
2007年 11月 2日 (金) 16:50:14 JST
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 @@ <label> Upload an image/audio file for this story [% IF pending_file_count %]([% pending_file_count %] awaiting processing)[% END %] </label> - <input type="file" name="media_file"><select name="media_action"><option value="upload">upload</option><option value="thumbnails">thumbnails</option></select> + <input type="file" name="media_file"> [% IF story_static_files && story_static_files.size %] <label> <a href="[% constants.rootdir %]/admin.pl?op=static_files&sid=[% sid %]">Media Files associated with this story</a> </label> <table cellpadding="3" cellspacing="3"> + <tr><td>Select <br>Thumb</td><td colspan="3"></td><td>Click to <br>add to body</td></tr> [% FOREACH mfile = story_static_files %] - [% trunc_name = mfile.name %] - [% trunc_name = trunc_name.replace('^\d+',"") %] - <tr><td>[% mfile.sfid %]</td><td><a href="[% constants.imagedir %]/articles/[% sid %][% trunc_name %]" style="color:#fff">[% mfile.name %]</td><td>[% constants.imagedir %]/articles/[% sid %][% trunc_name %]</td> - <td>[% mfile.width %]</td> + [% filename = mfile.name %] + [% filename = filename.replace(".*\/", ""); %] + <tr><td><input type="radio" name="thumb" value="[% mfile.sfid %]" [% IF storyref.thumb == mfile.sfid; constants.markup_checked_attribute; END %]></td><td>[% filename %]</td><td>[% mfile.width %]</td> <td>[% mfile.height %]</td> + <td> [% IF mfile.filetype == "image" %] -<img src="[% constants.imagedir %]/articles/[% sid %][% trunc_name %]" width="25%" height="25%"> +[% 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 %] +<a href="#bodytext" onclick="appendToBodytext('\n<img src=\'[% constants.imagedir %][% mfile.name %]\' width=\'[% mfile.width %]\' height=\'[% mfile.height %]\'>')"><img src="[% constants.imagedir %][% mfile.name %]" width="[% width %]" height="[% height %]"></a> +[% ELSE %] +<a href="#bodytext" onclick="appendToBodytext('\n<a href=\'[% constants.imagedir %][% mfile.name %]\'>[% filename %]</a>')">Add [% filename %]</a> +[% END %] </td> </tr> [% END %] + <tr><td><input type="radio" name="thumb" value="0"></td><td>None</td><td colspan="1"></td></tr> </table> [% END %] @@ -275,10 +288,15 @@ Upload a file for bodytext </label> <input type="file" name="bodytext_file"> + <a name="bodytext"></a> <label> - Extended Copy[% IF storyref.bodytext_wordcount %] <em>([% storyref.bodytext_wordcount %] word[% IF storyref.bodytext_wordcount != 1; "s"; END %])</em>[% END %] + <a href="#" onclick="toggleId('admin-bodytext','hide','show'); return false">Extended Copy</a>[% IF storyref.bodytext_wordcount %] <em>([% storyref.bodytext_wordcount %] word[% IF storyref.bodytext_wordcount != 1; "s"; END %])</em>[% END %] </label> - <textarea name="bodytext" rows="[% user.textarea_rows || constants.textarea_rows %]" cols="[% user.textarea_cols || constants.textarea_cols %]" wrap="virtual">[% storyref.bodytext | strip_literal %]</textarea> + <textarea name="bodytext" rows="[% user.textarea_rows || constants.textarea_rows %]" cols="[% user.textarea_cols || constants.textarea_cols %]" wrap="virtual" id="admin-bodytext" class="[% storyref.bodytext ? "show" : "hide" %]">[% storyref.bodytext | strip_literal %]</textarea> + <label> + <a href="#" onclick="toggleId('admin-media','hide','show'); return false">Media</a> + </label> + <textarea name="media" rows="[% user.textarea_rows || constants.textarea_rows %]" cols="[% user.textarea_cols || constants.textarea_cols %]" wrap="virtual" id="admin-media" class="[% storyref.media ? "show" : "hide" %]">[% storyref.media | strip_literal %]</textarea> <div class="notes">[% ispell_comments.bodytext %]</div> [% PROCESS editbuttons %] </fieldset> @@ -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__ <table cellpadding="3" cellspacing="3"> [% FOREACH mfile = story_static_files %] - [% trunc_name = mfile.name %] - [% trunc_name = trunc_name.replace('^\d+',"") %] - <tr><td>[% mfile.sfid %]</td><td><a href="[% constants.imagedir %]/articles/[% sid %][% trunc_name %]">[% mfile.name %]</td><td>[% constants.imagedir %]/articles/[% sid %][% trunc_name %]</td><td>[% mfile.width %]</td><td>[% mfile.height %]</td></tr> + <tr><td>[% mfile.sfid %]</td><td><a href="[% constants.imagedir %][% mfile.namename %]">[% mfile.name %]</td><td>[% constants.imagedir %][% mfile.name %]</td><td>[% mfile.width %]</td><td>[% mfile.height %]</td></tr> [% IF mfile.filetype == "image" %] - <tr><td colspan="t"><img src="[% constants.imagedir %]/articles/[% sid %][% trunc_name %]"></td></tr> + <tr><td colspan="t"><img src="[% constants.imagedir %][% mfile.name %]"></td></tr> [% 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 ] %] + +<form id ="modal_prefs" method="post"> + +<input type="hidden" name="formname" value="d2_posting"> +<input type="hidden" name="uid" value="[% user.uid %]"> + +<table width="100%"> + <tr> + <td valign="middle"> + <p> + + <b>Email Display</b> + (currently + [%- IF !user.fakeemail; " not displayed"; + ELSE; ": <tt>"; user.fakeemail | strip_literal; "</tt>"; + END %])<br> + [% IF !user.emaildisplay.defined; + IF user.fakeemail %] + <i>(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.)</i><br> + [% END; + user.emaildisplay = 0; + END; + IF user.emaildisplay.defined; + emaildisplay.${user.emaildisplay} = constants.markup_checked_attribute; + END %] + <blockquote><div> + <input type="radio" name="emaildisplay" [% emaildisplay.0 %] value=0> Do not display an e-mail address.<br> + <input type="radio" name="emaildisplay" [% emaildisplay.1 %] value=1> Show your email address with weekly updating spam armoring.<br> + <input type="radio" name="emaildisplay" [% emaildisplay.2 %] value=2> Show your real email address without cowering behind childish anonymity or obfuscation. + </div></blockquote> + + <b><a name="karma_bonus">Karma Bonus</a></b> (modifier assigned to posts where the user has good karma)<br> + [% karma_bonus = 0; + IF user.karma_bonus; + karma_bonus = user.karma_bonus; + END %] + [% Slash.createSelect('karma_bonus', range, karma_bonus, 1, 1) %] + + <p> + + [% IF user.karma > constants.goodkarma; + b_check = ''; + IF user.nobonus; + b_check = constants.markup_checked_attribute; + END %] + <input type="hidden" name="nobonus_present" value="1"> + <label><input type="checkbox" name="nobonus"[% b_check %]> No Karma Bonus</label> + + <p> + [% END %] + + <b><a name="subscriber_bonus">Subscriber Bonus</a></b> (modifier assigned to posts where the user was a subscriber)<br> + [% subscriber_bonus = 0; + IF user.subscriber_bonus; + subscriber_bonus = user.subscriber_bonus; + END %] + [% Slash.createSelect('subscriber_bonus', range, subscriber_bonus, 1, 1) %] + + <p> + + [% IF user.is_subscriber; + sb_check = ''; + IF user.nosubscriberbonus; + sb_check = constants.markup_checked_attribute; + END %] + <input type="hidden" name="nosubscriberbonus_present" value="1"> + <label><input type="checkbox" name="nosubscriberbonus"[% sb_check %]> No Subscriber Bonus</label> + [% END %] + + <label>Comment Box Size</label> + [% 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: <input type="text" name="textarea_cols" size="4" value="[% user.textarea_cols || constants.textarea_cols %]"> + Rows: <input type="text" name="textarea_rows" size="4" value="[% user.textarea_rows || constants.textarea_rows %]"> + [% PROCESS formNote note="Also applies to other large text boxes" %] + + <label>Comment Post Mode</label> + [% + formats = Slash.db.getDescriptions('postmodes'); + Slash.createSelect('posttype', formats, user.posttype, 1); + %] + + <p> + + [% + p_check = ''; + IF user.postanon; + p_check = constants.markup_checked_attribute; + END; + %] + + [% IF constants.allow_anonymous && (user.karma > -1 || p_check) %] + <input type="hidden" name="postanon_present" value="1"> + <label><input type="checkbox" name="postanon"[% p_check %]> Post Anonymously</label> + </label> + [% END %] + + [% IF user.is_admin; + nospell_check = ''; + IF user.no_spell; + nospell_check = constants.markup_checked_attribute; + END %] + <label><input type="checkbox" name="no_spell"[% nospell_check %]> Disable Spellchecker</label> + [% END %] + </td> + </tr> +</table> + <p> +<input type="button" value="Save" onclick="saveModalPrefs()"> +</form> +__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 =~/<media:thumbnail url="([^"]+)"/; + $thumb = $1; + $thumb =~ s/amp;//g; + + } elsif ($page =~ /link\s+rel="videothumbnail"\s+href="([^"]*)"/) { + $thumb = $1; + } elsif ($page =~ /link\s+rel="image_src"\s+href="([^"]*)"/) { + $thumb = $1; + } + + if ($thumb) { + slashdLog("Thumb url: $thumb"); + my $ft = File::Type->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'); %] - - <div class="[% IF bodycontent && mode == "fulltitle" %]hide[% ELSIF bodycontent %]body[% ELSE %]empty[% END %]" id="fhbody-[% item.id %]" [% IF !topic.image %]style="min-height: auto !important; "[% END %]> + [% hasimage = item.tid || (item.thumb && item.type == "story") || (adminmode && item.type == "submission") %] + <div class="[% IF bodycontent && mode == "fulltitle" %]hide[% ELSIF bodycontent %]body[% ELSE %]empty[% END %]" id="fhbody-[% item.id %]" [% IF !hasimage %]style="min-height: auto !important; "[% END %]> [% END %] - [% IF item.tid %] - <div class="topic"> + [% IF hasimage %] + <div class="topic" id="topic-[% item.id %]"> [% IF bodycontent %] - [% topic = Slash.db.getTopic(item.tid) %] - [% IF user.noicons || user.simpledesign || user.lowbandwidth %] - [ <a href="[% gSkin.rootdir %]/search.pl?tid=[% topic.tid %]">[% topic.textname %]</a> ] - [% ELSIF topic.image %] - <a href="[% gSkin.rootdir %]/search.pl?tid=[% topic.tid %]"> - <img src="[% constants.imagedir %]/topics/[% topic.image %]" width="[% topic.width %]" height="[% topic.height %]" alt="[% topic.textname %]" title="[% topic.textname %]" > - </a> + [% PROCESS dispTopicFireHose item = item %] [% END %] - [% END %] </div> [% END %] <div id="text-[% item.id %]" class="intro"> @@ -99,6 +92,11 @@ PROCESS formatHoseIntro; END %] [% introtext %] + [% IF item.media %] + <div class="media"> + [% item.media %] + </div> + [% END %] </div> [% IF bodywrapper %] </div> @@ -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 %] + <a href="[% link_url %]"><img src="[% constants.imagedir %][% file.name %]" alt="thumbnail" [% IF file.width; "width='$file.width'"; END; IF file.height; " height='$file.height'"; END; %]></a> + +[% ELSIF user.noicons || user.simpledesign || user.lowbandwidth %] + [ <a href="[% gSkin.rootdir %]/search.pl?tid=[% topic.tid %]">[% topic.textname %]</a> ] +[% ELSIF topic.image %] + <a href="[% gSkin.rootdir %]/search.pl?tid=[% topic.tid %]"> + <img src="[% constants.imagedir %]/topics/[% topic.image %]" width="[% topic.width %]" height="[% topic.height %]" alt="[% topic.textname %]" title="[% topic.textname %]" > + </a> +[% 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 @@ </div> </div> __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('<break time=\"1s\">', + 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. %] -<b>PLEASE READ THE DIRECTIONS CAREFULLY BEFORE EMAILING -[% constants.siteadmin_name.uc %]!</b> <p>What follows are random +<b>PLEASE READ THE DIRECTIONS CAREFULLY BEFORE EMAILING US!</b> +<p>What follows are random moderations performed on comments in the last few weeks on [% constants.sitename %]. You are asked to <b>honestly</b> 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' %] -<input type="text" id="tags_admin_commands-[% sidenc %]" name="tags_admin_commands-[% sidenc %]" value="" size=50 maxlength=60 onkeyup="handleEnter(event, adminTagsCommands, '[% sidenc %]')"> +<input type="text" id="tags_admin_commands-[% sidenc %]" name="tags_admin_commands-[% sidenc %]" value="" size=50 maxlength=150 onkeyup="handleEnter(event, adminTagsCommands, '[% sidenc %]')"> <input type="button" value="Admin" onclick="adminTagsCommands('[% sidenc %]','stories')" class="button"> <span id="taghist-[% sidenc %]"><a href="#" onclick="tagsHistory('[% sidenc %]','stories'); return false">[History]</a></span> <div>[% tags_admin_str %]</div> @@ -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' %] -<input type="text" id="tags_admin_commands-[% id %]" name="tags_admin_commands-[% id %]" value="" size=50 maxlength=60> +<input type="text" id="tags_admin_commands-[% id %]" name="tags_admin_commands-[% id %]" value="" size=50 maxlength=150> <input type="button" value="Admin" onclick="adminTagsCommands('[% id %]','urls')" class="button"> <span id="taghist-[% id %]"><a href="#" onclick="tagsHistory('[% id %]','urls'); return false">[History]</a></span> <div>[% tags_admin_str %]</div> @@ -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 @@ <a href="[% gSkin.rootdir %]/users.pl">Create an Account!</a> [% END %] - +[% IF !user.is_anon && user.discussion2 && user.discussion2 == "slashdot"; + prefslink = "<a href=\"" _ gSkin.rootdir _ "/my/comments\" target=\"_blank\""; + IF constants.modal_prefs_active; + prefslink = prefslink _ " onclick=\"getModalPrefs('d2_posting', 'Discussion 2')\; return false\""; + END; + + prefslink = prefslink _ ">Customize Posting Preferences</a><p> <br>"; + + prefslink; +END %] + [% IF !user.is_anon && user.karma > constants.goodkarma %] <input type="hidden" name="nobonus_present" value="1"> <input type="checkbox" name="nobonus"[% IF form.nobonus; constants.markup_checked_attribute ; END %]> No Karma Bonus @@ -245,7 +255,15 @@ </form> </div> </div> + +<div id="modal_cover" style="display:none" onclick="hide_modal_box()"></div> +<div id="modal_box" style="display:none"> + <div class="generaltitle" > + <div class="title"><h3><div id="preference_title"></div> <a href="#" onclick="hide_modal_box(); return false"><img src="[% gSkin.imagedir %]/images/sic_close.png" alt="Close"></a></h3></div> + </div> + <div id="modal_box_content"></div> +</div> __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 $