[Slashdotjp-dev 691] [198] merged from upstram T_2_5_0_180

アーカイブの一覧に戻る

svnno****@sourc***** svnno****@sourc*****
2007年 10月 18日 (木) 23:21:50 JST


Revision: 198
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=198
Author:   tach
Date:     2007-10-18 23:21:49 +0900 (Thu, 18 Oct 2007)

Log Message:
-----------
merged from upstram T_2_5_0_180

Modified Paths:
--------------
    slashjp/trunk/Slash/DB/MySQL/MySQL.pm
    slashjp/trunk/Slash/DB/Static/MySQL/MySQL.pm
    slashjp/trunk/Slash/Slash.pm
    slashjp/trunk/Slash/Utility/Environment/Environment.pm
    slashjp/trunk/plugins/Admin/admin.pl
    slashjp/trunk/plugins/Admin/templates/editStory;admin;default
    slashjp/trunk/plugins/Ajax/htdocs/ajax.pl
    slashjp/trunk/plugins/Ajax/htdocs/images/common.js
    slashjp/trunk/plugins/Ajax/templates/prefs_d2;ajax;default
    slashjp/trunk/plugins/HumanConf/HumanConf.pm
    slashjp/trunk/plugins/HumanConf/Static/Static.pm
    slashjp/trunk/plugins/HumanConf/mysql_schema
    slashjp/trunk/plugins/Login/login.pl
    slashjp/trunk/sql/mysql/defaults.sql
    slashjp/trunk/sql/mysql/slashschema_create.sql
    slashjp/trunk/sql/mysql/upgrades
    slashjp/trunk/tagboxes/FHActivity/FHActivity.pm
    slashjp/trunk/tagboxes/FHEditorPop/FHEditorPop.pm
    slashjp/trunk/tagboxes/FHPopularity/FHPopularity.pm
    slashjp/trunk/tagboxes/FireHoseScores/FireHoseScores.pm
    slashjp/trunk/tagboxes/FireHoseScores/mysql_dump.sql
    slashjp/trunk/tagboxes/TagCountUser/TagCountUser.pm
    slashjp/trunk/tagboxes/Top/Top.pm
    slashjp/trunk/themes/slashcode/THEME
    slashjp/trunk/themes/slashcode/htdocs/users.pl
    slashjp/trunk/themes/slashcode/templates/editComm;users;default
    slashjp/trunk/themes/slashcode/templates/printCommentsMain;misc;default

Added Paths:
-----------
    slashjp/trunk/plugins/Admin/templates/static_files;admin;default
    slashjp/trunk/themes/slashcode/tasks/process_file_queue.pl


-------------- next part --------------
Modified: slashjp/trunk/Slash/DB/MySQL/MySQL.pm
===================================================================
--- slashjp/trunk/Slash/DB/MySQL/MySQL.pm	2007-10-18 14:07:12 UTC (rev 197)
+++ slashjp/trunk/Slash/DB/MySQL/MySQL.pm	2007-10-18 14:21:49 UTC (rev 198)
@@ -272,6 +272,9 @@
 		=> sub { $_[0]->sqlSelectMany('dkid, name', 'discussion_kinds') },
 
 	'd2_comment_q'
+		=> sub { $_[0]->sqlSelectMany('code, name', 'code_param', "type='d2_comment_q' AND code != 0") },
+
+	'd2_comment_q_all'
 		=> sub { $_[0]->sqlSelectMany('code, name', 'code_param', "type='d2_comment_q'") },
 
 	'd2_comment_limits'
@@ -279,7 +282,6 @@
 
 	'd2_comment_order'
 		=> sub { $_[0]->sqlSelectMany('code, name', 'code_param', "type='d2_comment_order'") },
-
 );
 
 ########################################################
@@ -10316,7 +10318,7 @@
 	my %old_values = ( );
 	my %new_values = ( );
 	if ($constants->{plugin}{Tags}) {
-		my @update_keys = sort keys %$hashref;
+		my @update_keys = sort map { s/^-//; $_ } keys %$hashref;
 		my $tagboxdb = getObject('Slash::Tagbox');
 		my @log_keys = $tagboxdb->userKeysNeedTagLog(\@update_keys);
 		%old_values = ( map { ($_, undef) } @log_keys );
@@ -10345,7 +10347,7 @@
 		}
 		# If a tagbox needs copies of before-and-after data, first
 		# get a copy of the old data.
-		my @columns_needed = grep { exists $old_values{$_} } keys %minihash;
+		my @columns_needed = sort grep { exists $old_values{$_} } map { s/^-//; $_ } keys %minihash;
 		if (@columns_needed) {
 			my $old_hr = $self->sqlSelectHashref(
 				join(',', @columns_needed), $table, $where);
@@ -12484,6 +12486,37 @@
 	}
 }
 
+sub addFileToQueue {
+	my($self, $file) = @_;
+	$self->sqlInsert("file_queue", $file);
+}
+
+sub numPendingFilesForStory {
+	my($self, $stoid) = @_;
+	my $stoid_q = $self->sqlQuote($stoid);
+	$self->sqlCount("file_queue", "stoid=$stoid_q");
+}
+
+sub addStoryStaticFile {
+	my($self, $data) = @_;
+	$data ||= "";
+	
+	# Guess at file type if it isn't set
+	if ($data->{name} =~ /\.(jpg|gif|png)$/) {
+		$data->{filetype} ||= "image";
+	} elsif ($data->{name} =~ /\.(jpg|gif|png)$/) {
+		$data->{filetype} ||= "audio";
+	}
+
+	$self->sqlInsert("story_static_files", $data);
+}
+
+sub getStaticFilesForStory {
+	my($self, $stoid) = @_;
+	my $stoid_q = $self->sqlQuote($stoid);
+	return $self->sqlSelectAllHashrefArray("*", "story_static_files", "stoid=$stoid_q");
+}
+
 ########################################################
 sub DESTROY {
 	my($self) = @_;

Modified: slashjp/trunk/Slash/DB/Static/MySQL/MySQL.pm
===================================================================
--- slashjp/trunk/Slash/DB/Static/MySQL/MySQL.pm	2007-10-18 14:07:12 UTC (rev 197)
+++ slashjp/trunk/Slash/DB/Static/MySQL/MySQL.pm	2007-10-18 14:21:49 UTC (rev 198)
@@ -1917,6 +1917,17 @@
 	);
 }
 
+sub getNextFileQueueCmds {
+	my($self) = @_;
+	return $self->sqlSelectAllHashrefArray("*", "file_queue", "", "ORDER BY fqid LIMIT 10");
+}
+
+sub deleteFileQueueCmd {
+	my($self,$fqid) = @_;
+	my $fqid_q = $self->sqlQuote($fqid);
+	$self->sqlDelete("file_queue", "fqid=$fqid_q");
+}
+
 1;
 
 __END__

Modified: slashjp/trunk/Slash/Slash.pm
===================================================================
--- slashjp/trunk/Slash/Slash.pm	2007-10-18 14:07:12 UTC (rev 197)
+++ slashjp/trunk/Slash/Slash.pm	2007-10-18 14:21:49 UTC (rev 198)
@@ -145,7 +145,7 @@
 	my $d2_comment_q = $user->{d2_comment_q};
 	if ($discussion2 && !$d2_comment_q) {
 		if ($user->{is_anon}) {
-			$d2_comment_q = 5;
+			$d2_comment_q = 5; # medium
 		}
 	}
 

Modified: slashjp/trunk/Slash/Utility/Environment/Environment.pm
===================================================================
--- slashjp/trunk/Slash/Utility/Environment/Environment.pm	2007-10-18 14:07:12 UTC (rev 197)
+++ slashjp/trunk/Slash/Utility/Environment/Environment.pm	2007-10-18 14:21:49 UTC (rev 198)
@@ -1582,7 +1582,7 @@
 		my $i = $2;
 
 #		# for (0..255) { $x = ((($_-1)/256) < .1); last if !$x; printf "%d:%d\n", $_, $x; }
-		if ($ENV{GATEWAY_INTERFACE} && ( $i == 144 || $i == 113 || ((($i-1)/256) < .1) ) ) {  # 10 percent, x.(0..3).y.z
+		if ($ENV{GATEWAY_INTERFACE} && ( $i == 144 || ((($i-1)/256) < .5) ) ) {  # 10 percent, x.(0..3).y.z
 			my $d2 = 'slashdot';
 
 			# get user-agent (ENV not populated yet)
@@ -1847,7 +1847,7 @@
 		url_id spider_id miner_id keyword_id
 		st_main_select stc_main_select
 		parent_topic child_topic
-		skid primaryskid
+		skid primaryskid d2_comment_q d2_comment_order
 	),
 	# Survey
 	qw(
@@ -3198,13 +3198,28 @@
 an SQL function or value which can be used as part of a test against
 or an assignment into an SQL integer value.  This value should _not_ be
 quoted but rather inserted directly into an SQL request.  For example,
-if passed "123" (a user id), will return "'123'" (same value,
-quoted);  if passed "200123456789abcd" (an encoded IP), will return
-"CONV('200123456789abcd', 16, 10)" which can be used as an assignment
-into or test against a BIGINT column.
+if passed "123" (a user id), will return "CAST('123' AS UNSIGNED)"
+(same value, quoted);  if passed "200123456789abcd" (an encoded IP),
+will return "CAST(CONV('200123456789abcd', 16, 10) AS UNSIGNED" which
+can be used as an assignment into or test against a BIGINT column.
 
 For speed, does not do error-checking against the value passed in.
 
+There are tricky technical reasons why all values that are used in
+comparisons to srcid columns must be wrapped in a CAST(x AS UNSIGNED).
+Tricky enough that I submitted a MySQL bug report which turned out to
+be not a bug:  <http://bugs.mysql.com/bug.php?id=24759>.  The short
+explanation is that any comparison of a number (the srcid column in
+the table) to a string results in both being internally converted to
+a float before the comparison, and floats with more bits of data than
+will fit in their mantissa do not always compare "equal to themselves."
+We must ensure that the values compared against the BIGINT column are not
+strings, and that means wrapping both a quoted uid ('123' is a string)
+and a CONV (which returns a string) in a CAST.  Note that even integers
+known to have fewer bits than a float's mantissa, such as uid's, cannot
+be quoted strings, as that can break equality testing even for other
+properly-CAST values in an IN list.
+
 Usage:
 
 $slashdb->sqlInsert("al2", { srcid => get_srcid_sql_in($srcid) });
@@ -3227,10 +3242,9 @@
 	my $slashdb = getCurrentDB();
 	my $srcid_q = $slashdb->sqlQuote($srcid);
 	my $type = get_srcid_type($srcid);
-	if ($type eq 'uid') {
-		return $srcid_q;
-	}
-	return "CAST(CONV($srcid_q, 16, 10) AS UNSIGNED)";
+	return $type eq 'uid'
+		? "CAST($srcid_q AS UNSIGNED)"
+		: "CAST(CONV($srcid_q, 16, 10) AS UNSIGNED)";
 }
 
 #========================================================================

Modified: slashjp/trunk/plugins/Admin/admin.pl
===================================================================
--- slashjp/trunk/plugins/Admin/admin.pl	2007-10-18 14:07:12 UTC (rev 197)
+++ slashjp/trunk/plugins/Admin/admin.pl	2007-10-18 14:21:49 UTC (rev 198)
@@ -209,6 +209,11 @@
 			seclev		=> 500,
 			adminmenu	=> 'info',
 			tab_selected	=> 'pw'
+		},
+		static_files		=> {
+			function	=> \&showStaticFiles,
+			seclev		=> 100,
+			adminmenu	=> 'info',
 		}
 	};
 
@@ -1136,25 +1141,6 @@
 			'stoid', 1);
 	}
 
-	# handle any media files that were given
-	if ($form->{media_file}) {
-		my $upload = $form->{query_apache}->upload;
-		if ($upload) {
-			my $fh = $upload->fh;
-			mkpath("/tmp/upload", 0, 0777) unless -e "/tmp/upload";
-			$form->{media_file} =~ s|^.*?([^/:\\]+)$|$1|;
-			my $name = $form->{media_file};
-			my $ofh = gensym();
-			if (!open $ofh, ">/tmp/upload/$name\0") {
-			} else {
-				while (<$fh>) {
-					print $ofh $_;
-				}
-				close $ofh;
-				$slashdb->insertMediaFile($stoid, $name);
-			}
-		}
-	}
 
 	# Basically, we upload the bodytext if we realize a name has been passed in -Brian
 	if ($form->{bodytext_file}) {
@@ -1313,6 +1299,7 @@
 				$storyref->{$field});
 		}
 		$display_check = $storyref->{neverdisplay} ? '' : $constants->{markup_checked_attribute};
+		handleMediaFileForStory($stoid);
 
 	} else { # New Story
 
@@ -1527,7 +1514,11 @@
 			tags_example	=> \@tags_example,
 		}, { Return => 1 });
 	}
-
+	my $pending_file_count = 0;
+	my $story_static_files = [];
+	if ($stoid) {
+		$pending_file_count = $slashdb->numPendingFilesForStory($stoid); 		$story_static_files = $slashdb->getStaticFilesForStory($stoid);
+	}
 	slashDisplay('editStory', {
 		stoid			=> $stoid,
 		storyref 		=> $storyref,
@@ -1557,6 +1548,8 @@
 		user_signoff		=> $user_signoff,
 		add_related_text	=> $add_related_text,
 		yoogli_similar_stories  => $yoogli_similar_stories,
+		pending_file_count	=> $pending_file_count,
+		story_static_files	=> $story_static_files
 	});
 }
 
@@ -2107,12 +2100,50 @@
 
 		$slashdb->setRelatedStoriesForStory($form->{sid}, $related_sids_hr, $related_urls_hr, $related_cids_hr, $related_firehose_hr);
 		$slashdb->createSignoff($st->{stoid}, $user->{uid}, "updated");
+
+
+		# handle any media files that were given
+		handleMediaFileForStory($st->{stoid});
+
 		# make sure you pass it the goods
 		listStories(@_);
 	}
 }
 
 ##################################################################
+sub handleMediaFileForStory {
+	my($stoid) = @_;
+	my $form    = getCurrentForm();
+	my $slashdb = getCurrentDB();
+	if ($form->{media_file}) {
+		my $upload = $form->{query_apache}->upload;
+		if ($upload) {
+			my $fh = $upload->fh;
+			use File::Path;
+			mkpath("/tmp/upload", 0, 0755) unless -e "/tmp/upload";
+			$form->{media_file} =~ s|^.*?([^/:\\]+)$|$1|;
+			my $name = $form->{media_file};
+			my $suffix;
+			($suffix) = $name =~ /(\.\w+)$/;
+			use File::Temp qw(:mktemp);
+			my ($ofh, $tmpname) = mkstemps("/tmp/upload/fileXXXXXX", $suffix );
+				
+			while (<$fh>) {
+				print $ofh $_;
+			}
+			close $ofh;
+			my $file = {
+				stoid	=> $stoid,
+				file	=> "$tmpname",
+				action 	=> "upload",
+			};
+			$slashdb->addFileToQueue($file);
+		}
+	}
+	
+}
+
+##################################################################
 sub displaySlashd {
 	my($form, $slashdb, $user, $constants) = @_;
 	my $answer = $slashdb->getSlashdStatuses();
@@ -2425,6 +2456,7 @@
 		slashHook('admin_save_story_success', { story => $data });
 		my $st = $slashdb->getStory($data->{sid});
 		my $stoid = $st->{stoid};
+		handleMediaFileForStory($stoid);
 		my %warn_skids = map {$_ => 1 } split('\|', $constants->{admin_warn_primaryskid});
 		my $data = {};
 		if ($warn_skids{$st->{primaryskid}}) {
@@ -2628,6 +2660,13 @@
 
 }
 
+sub showStaticFiles {
+	my($form, $slashdb, $user, $constants) = @_;
+	my $story = $slashdb->getStory($form->{sid});
+	my $story_static_files = $slashdb->getStaticFilesForStory($story->{stoid});
+	slashDisplay("static_files", { story_static_files => $story_static_files, sid => $form->{sid} }); 
+}
+
 createEnvironment();
 main();
 1;

Modified: slashjp/trunk/plugins/Admin/templates/editStory;admin;default
===================================================================
--- slashjp/trunk/plugins/Admin/templates/editStory;admin;default	2007-10-18 14:07:12 UTC (rev 197)
+++ slashjp/trunk/plugins/Admin/templates/editStory;admin;default	2007-10-18 14:21:49 UTC (rev 198)
@@ -246,17 +246,25 @@
 				[% PROCESS editbuttons %]
 
 				<label>
-					Upload an image/audio file for this story
+					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">
 
-				[% IF story_media_ref %]
+				[% IF story_static_files && story_static_files.size  %]
 					<label>
-						Media Files associated with this story
+						<a href="[% constants.rootdir %]/admin.pl?op=static_files&amp;sid=[% sid %]">Media Files associated with this story</a>
 					</label>
-					<table border="0" class="data">
-					[% FOREACH mfile = story_media_ref %]
-					<tr><td>mfile.smid</td><td>mfile.name</td></tr>
+					<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 %]" style="color:#fff">[% mfile.name %]</td><td>[% constants.imagedir %]/articles/[% sid %][% trunc_name %]</td>
+<td>
+[% IF mfile.filetype == "image" %]
+<img src="[% constants.imagedir %]/articles/[% sid %][% trunc_name %]" width="25%" height="25%">
+[% END %]
+</td>
+</tr>
 					[% END %]
 					</table>
 				[% END %]

Added: slashjp/trunk/plugins/Admin/templates/static_files;admin;default
===================================================================
--- slashjp/trunk/plugins/Admin/templates/static_files;admin;default	2007-10-18 14:07:12 UTC (rev 197)
+++ slashjp/trunk/plugins/Admin/templates/static_files;admin;default	2007-10-18 14:21:49 UTC (rev 198)
@@ -0,0 +1,31 @@
+__section__
+default
+__description__
+You should describe stuff here.
+__title__
+Useless title to template
+__page__
+admin
+__lang__
+en_US
+__name__
+static_files
+__seclev__
+10000
+__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></tr>
+	[% IF mfile.filetype == "image" %]
+	<tr><td colspan="3"><img src="[% constants.imagedir %]/articles/[% sid %][% trunc_name %]"></td></tr>
+	[% END %]
+
+[% END %]
+</table>
+
+
+
+__version__
+$Id: static_files;admin;default,v 1.1 2007/10/16 22:59:06 tvroom Exp $

Modified: slashjp/trunk/plugins/Ajax/htdocs/ajax.pl
===================================================================
--- slashjp/trunk/plugins/Ajax/htdocs/ajax.pl	2007-10-18 14:07:12 UTC (rev 197)
+++ slashjp/trunk/plugins/Ajax/htdocs/ajax.pl	2007-10-18 14:21:49 UTC (rev 198)
@@ -526,7 +526,6 @@
                 d2_comment_order => $params{'d2_comment_order'} || undef,
                 emaildisplay     => $params{'emaildisplay'}     || undef,
                 nosigs           => ($params{'nosigs'}          ? 1 : 0),
-                no_spell         => ($params{'no_spell'}        ? 1 : 0),
         };
 
         $slashdb->setUser($params{uid}, $user_edits_table);

Modified: slashjp/trunk/plugins/Ajax/htdocs/images/common.js
===================================================================
--- slashjp/trunk/plugins/Ajax/htdocs/images/common.js	2007-10-18 14:07:12 UTC (rev 197)
+++ slashjp/trunk/plugins/Ajax/htdocs/images/common.js	2007-10-18 14:21:49 UTC (rev 198)
@@ -1415,7 +1415,8 @@
 	return;
 }
 
-function getModalPrefs(section) {
+function getModalPrefs(section, title) {
+        document.getElementById('preference_title').innerHTML = title;
 	var params = [];
 	params['op'] = 'getModalPrefs';
 	params['section'] = section;

Modified: slashjp/trunk/plugins/Ajax/templates/prefs_d2;ajax;default
===================================================================
--- slashjp/trunk/plugins/Ajax/templates/prefs_d2;ajax;default	2007-10-18 14:07:12 UTC (rev 197)
+++ slashjp/trunk/plugins/Ajax/templates/prefs_d2;ajax;default	2007-10-18 14:21:49 UTC (rev 198)
@@ -23,16 +23,16 @@
 		[% IF user.discussion2 && user.discussion2 == "slashdot" %]
                 	<blockquote>
 			<div>
-                	How Many Comments
-                	[% comment_q = Slash.db.getDescriptions('d2_comment_q');
-                   	comment_q_def = user.d2_comment_q || 0;
-                   	Slash.createSelect('d2_comment_q', comment_q, comment_q_def, 1) %]<br>
-                	
+			How Many Comments
+			[% comment_q_name = (user.is_subscriber || user.is_admin) ? 'd2_comment_q_all' : 'd2_comment_q';
+			   comment_q = Slash.db.getDescriptions(comment_q_name);
+			   Slash.createSelect('d2_comment_q', comment_q, user.d2_comment_q, 1) %]<br>
+
 			Comment Retrieval Order
-                	[% comment_order = Slash.db.getDescriptions('d2_comment_order');
-                   	comment_order_def = user.d2_comment_order || 0;
-                   	Slash.createSelect('d2_comment_order', comment_order, comment_order_def, 1) %]
-                	</div>
+			[% comment_order = Slash.db.getDescriptions('d2_comment_order');
+			   comment_order_def = user.d2_comment_order || 0; # score
+			   Slash.createSelect('d2_comment_order', comment_order, comment_order_def, 1) %]
+			</div>
 			</blockquote>
                 [% END %]
 
@@ -68,14 +68,6 @@
 
 		<label><input type="checkbox" name="nosigs"[% s_check %]>&nbsp;Disable Sigs</label>
                 [% PROCESS formNote note='Strip sig quotes from comments' %]
-
-                [% 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 %]>&nbsp;Disable Spellchecker</label>
-                [% END %]
 	</td>
 	</tr>
 </table>

Modified: slashjp/trunk/plugins/HumanConf/HumanConf.pm
===================================================================
--- slashjp/trunk/plugins/HumanConf/HumanConf.pm	2007-10-18 14:07:12 UTC (rev 197)
+++ slashjp/trunk/plugins/HumanConf/HumanConf.pm	2007-10-18 14:21:49 UTC (rev 198)
@@ -78,7 +78,7 @@
 			"hcpid, html",
 			"humanconf_pool",
 			"hcqid=" . $slashdb->sqlQuote($hcqid)
-				. " AND filename != ''"
+				. " AND filename_img != ''"
 				. " AND created_at < DATE_SUB(NOW(), INTERVAL $secs SECOND)"
 				. " AND inuse = 0",
 			"ORDER BY RAND() LIMIT 1"

Modified: slashjp/trunk/plugins/HumanConf/Static/Static.pm
===================================================================
--- slashjp/trunk/plugins/HumanConf/Static/Static.pm	2007-10-18 14:07:12 UTC (rev 197)
+++ slashjp/trunk/plugins/HumanConf/Static/Static.pm	2007-10-18 14:21:49 UTC (rev 198)
@@ -266,7 +266,7 @@
 	my $success = $self->sqlInsert("humanconf_pool", {
 		hcqid =>	$question,
 		answer =>	$answer,
-		filename =>	"",
+		filename_img =>	"",
 		html =>		"",
 		inuse =>	1,
 	});
@@ -348,7 +348,8 @@
 	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\">',
-		map { uc } split //, $answer);
+		"\u$answer.",
+		map { "\u$_." } split //, $answer);
 
 	my @voices = split / /, ($constants->{hc_cepstral_voices} || 'William');
 	my $voice = $voices[rand @voices];
@@ -357,19 +358,19 @@
 	my $logdir = $constants->{logdir};
 	my $cepstral_prefix = catfile($logdir, "cepstral.");
 	my $ssml_fh = undef;
-	my $ssml_file = File::Temp::mktemp("${cepstral_prefix}XXXXXXXXXX.ssml");
+	my $ssml_file = File::Temp::mktemp("${cepstral_prefix}.ssml.XXXXXXXXXX");
 	if (open(my $ssml_fh, ">$ssml_file")) {
 		print $ssml_fh $ssml_text;
 		close $ssml_fh;
 	}
-	my $wav_file = $ssml_file; $wav_file =~ s/\.ssml$/.wav/;
+	my $wav_file = $ssml_file; $wav_file =~ s/\.ssml\./.wav./;
 	system("swift -f $ssml_file -o $wav_file");
 	unlink($ssml_file);
 	if ($constants->{hc_cepstral_mp3encoder}) {
 		system("$constants->{hc_cepstral_mp3encoder} -S --resample 22.05 $wav_file $full_filename_mp3");
 	}
 	unlink($wav_file);
-	return $full_filename_mp3;
+	return $filename_mp3;
 }
 
 sub get_sizediff {

Modified: slashjp/trunk/plugins/HumanConf/mysql_schema
===================================================================
--- slashjp/trunk/plugins/HumanConf/mysql_schema	2007-10-18 14:07:12 UTC (rev 197)
+++ slashjp/trunk/plugins/HumanConf/mysql_schema	2007-10-18 14:21:49 UTC (rev 198)
@@ -23,7 +23,7 @@
 	inuse		TINYINT DEFAULT '0' NOT NULL,
 	filename_img	VARCHAR(63) NOT NULL,
 	filename_mp3	VARCHAR(63) DEFAULT NULL,
-	html		VARCHAR(255) NOT NULL,
+	html		TEXT NOT NULL,
 	PRIMARY KEY (hcpid),
 	KEY answer (answer),
 	KEY lastused (lastused)

Modified: slashjp/trunk/plugins/Login/login.pl
===================================================================
--- slashjp/trunk/plugins/Login/login.pl	2007-10-18 14:07:12 UTC (rev 197)
+++ slashjp/trunk/plugins/Login/login.pl	2007-10-18 14:21:49 UTC (rev 198)
@@ -468,10 +468,10 @@
 	my $params  = $reader->getDescriptions('otherusersparam');
 
 	for my $param (keys %$params) {
-		if (exists $form->{$param}) {
-			# set user too for output in this request
-			$data->{$param} = $user->{$param} = $form->{$param} || undef;
-		}
+		# set user too for output in this request
+		$data->{$param} = $user->{$param} = defined($form->{$param})
+			? $form->{$param}
+			: $params->{$param};
 	}
 }
 

Modified: slashjp/trunk/sql/mysql/defaults.sql
===================================================================
--- slashjp/trunk/sql/mysql/defaults.sql	2007-10-18 14:07:12 UTC (rev 197)
+++ slashjp/trunk/sql/mysql/defaults.sql	2007-10-18 14:21:49 UTC (rev 198)
@@ -829,7 +829,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_179','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_180','The current cvs tag that the code was updated to - this does not affect site behavior but may be useful for your records');
 INSERT INTO vars (name, value, description) VALUES ('datadir','/usr/local/slash/www.example.com','What is the root of the install for Slash');
 INSERT INTO vars (name, value, description) VALUES ('db_auto_increment_increment','1','If your master DB uses auto_increment_increment, i.e. multiple master replication, echo its value into this var');
 INSERT INTO vars (name, value, description) VALUES ('dbsparklines_disp','0','Display dbsparklines in the currentAdminUsers box?');

Modified: slashjp/trunk/sql/mysql/slashschema_create.sql
===================================================================
--- slashjp/trunk/sql/mysql/slashschema_create.sql	2007-10-18 14:07:12 UTC (rev 197)
+++ slashjp/trunk/sql/mysql/slashschema_create.sql	2007-10-18 14:21:49 UTC (rev 198)
@@ -509,7 +509,21 @@
 	PRIMARY KEY (region)
 ) TYPE=InnoDB;
 
+
 #
+# Table structure for table 'file_queue'
+#
+
+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)
+) ENGINE=InnoDB;
+
+#
 # Table structure for table 'formkeys'
 #
 
@@ -1048,7 +1062,22 @@
 	INDEX tid_stoid (tid, stoid)
 ) TYPE=InnoDB;
 
+
 #
+# Table structure for table 'story_static_files'
+#
+
+DROP TABLE IF EXISTS 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",
+	name varchar(255) default '' NOT NULL,
+	PRIMARY KEY (sfid),
+	INDEX stoid(stoid)
+) ENGINE=InnoDB;
+
+#
 # Table structure for table 'string_param'
 #
 

Modified: slashjp/trunk/sql/mysql/upgrades
===================================================================
--- slashjp/trunk/sql/mysql/upgrades	2007-10-18 14:07:12 UTC (rev 197)
+++ slashjp/trunk/sql/mysql/upgrades	2007-10-18 14:21:49 UTC (rev 198)
@@ -4885,13 +4885,9 @@
 # 2007-10-04
 UPDATE vars SET value = 'T_2_5_0_177' WHERE name = 'cvs_tag_currentcode';
 
-# SLASHCODE/USEPERL LAST UPDATED HERE
-
 # 2007-10-05
 UPDATE vars SET value = 'T_2_5_0_178' WHERE name = 'cvs_tag_currentcode';
 
-# SLASHDOT LAST UPDATED HERE
-
 # For modal preferences
 INSERT INTO vars (name, value, description) VALUES ('modal_prefs_active', 1, 'Toggles modal preferences on/off');
 
@@ -4907,3 +4903,45 @@
 # 2007-10-11
 UPDATE vars SET value = 'T_2_5_0_179' WHERE name = 'cvs_tag_currentcode';
 
+# SLASHDOT LAST UPDATED HERE
+
+
+# default prefs for new /. accounts
+INSERT INTO string_param (type, code, name) VALUES ('otherusersparam','discussion2','slashdot');
+INSERT INTO string_param (type, code, name) VALUES ('otherusersparam','d2_comment_q','5'); # medium
+INSERT INTO string_param (type, code, name) VALUES ('otherusersparam','d2_comment_order','0'); # score
+
+# For plugins/HumanConf
+ALTER TABLE humanconf_pool MODIFY html TEXT NOT NULL;
+
+# For tagboxes/FireHoseScores
+INSERT INTO tagbox_userkeyregexes VALUES ('FireHoseScores', '^tag_clout$');
+
+# 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)
+) ENGINE=InnoDB;
+
+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",
+        name varchar(255) default '' NOT NULL,
+        PRIMARY KEY (sfid),
+        INDEX stoid(stoid)
+) ENGINE=InnoDB;
+
+
+# 2007-10-16
+UPDATE vars SET value = 'T_2_5_0_180' WHERE name = 'cvs_tag_currentcode';
+
+# SLASHCODE/USEPERL LAST UPDATED HERE
+

Modified: slashjp/trunk/tagboxes/FHActivity/FHActivity.pm
===================================================================
--- slashjp/trunk/tagboxes/FHActivity/FHActivity.pm	2007-10-18 14:07:12 UTC (rev 197)
+++ slashjp/trunk/tagboxes/FHActivity/FHActivity.pm	2007-10-18 14:21:49 UTC (rev 198)
@@ -37,15 +37,12 @@
 sub new {
 	my($class, $user) = @_;
 
-	my $plugin = getCurrentStatic('plugin');
-	return undef if !$plugin->{Tags} || !$plugin->{FireHose};
-	my($tagbox_name) = $class =~ /(\w+)$/;
-	my $tagbox = getCurrentStatic('tagbox');
-	return undef if !$tagbox->{$tagbox_name};
+	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;
@@ -57,6 +54,13 @@
 	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();

Modified: slashjp/trunk/tagboxes/FHEditorPop/FHEditorPop.pm
===================================================================
--- slashjp/trunk/tagboxes/FHEditorPop/FHEditorPop.pm	2007-10-18 14:07:12 UTC (rev 197)
+++ slashjp/trunk/tagboxes/FHEditorPop/FHEditorPop.pm	2007-10-18 14:21:49 UTC (rev 198)
@@ -41,15 +41,12 @@
 sub new {
 	my($class, $user) = @_;
 
-	my $plugin = getCurrentStatic('plugin');
-	return undef if !$plugin->{Tags} || !$plugin->{FireHose};
-	my($tagbox_name) = $class =~ /(\w+)$/;
-	my $tagbox = getCurrentStatic('tagbox');
-	return undef if !$tagbox->{$tagbox_name};
+	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;
@@ -61,6 +58,13 @@
 	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();

Modified: slashjp/trunk/tagboxes/FHPopularity/FHPopularity.pm
===================================================================
--- slashjp/trunk/tagboxes/FHPopularity/FHPopularity.pm	2007-10-18 14:07:12 UTC (rev 197)
+++ slashjp/trunk/tagboxes/FHPopularity/FHPopularity.pm	2007-10-18 14:21:49 UTC (rev 198)
@@ -37,15 +37,12 @@
 sub new {
 	my($class, $user) = @_;
 
-	my $plugin = getCurrentStatic('plugin');
-	return undef if !$plugin->{Tags} || !$plugin->{FireHose};
-	my($tagbox_name) = $class =~ /(\w+)$/;
-	my $tagbox = getCurrentStatic('tagbox');
-	return undef if !$tagbox->{$tagbox_name};
+	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;
@@ -57,6 +54,13 @@
 	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();

Modified: slashjp/trunk/tagboxes/FireHoseScores/FireHoseScores.pm
===================================================================
--- slashjp/trunk/tagboxes/FireHoseScores/FireHoseScores.pm	2007-10-18 14:07:12 UTC (rev 197)
+++ slashjp/trunk/tagboxes/FireHoseScores/FireHoseScores.pm	2007-10-18 14:21:49 UTC (rev 198)
@@ -37,15 +37,12 @@
 sub new {
 	my($class, $user) = @_;
 
-	my $plugin = getCurrentStatic('plugin');
-	return undef if !$plugin->{Tags} || !$plugin->{FireHose};
-	my($tagbox_name) = $class =~ /(\w+)$/;
-	my $tagbox = getCurrentStatic('tagbox');
-	return undef if !$tagbox->{$tagbox_name};
+	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;
@@ -57,6 +54,13 @@
 	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();
@@ -116,11 +120,44 @@
 sub feed_userchanges {
 	my($self, $users_ar) = @_;
 	my $constants = getCurrentStatic();
+	my $tagsdb = getObject('Slash::Tags');
 	main::tagboxLog("FireHoseScores->feed_userchanges called: users_ar='" . join(' ', map { $_->{tuid} } @$users_ar) .  "'");
 
-	# XXX need to fill this in, and check FirstMover feed_userchanges too
+	my %max_tuid = ( );
+	my %uid_change_sum = ( );
+	my %globj_change = ( );
+	for my $hr (@$users_ar) {
+		next unless $hr->{user_key} eq 'tag_clout';
+		$max_tuid{$hr->{uid}} ||= $hr->{tuid};
+		$max_tuid{$hr->{uid}}   = $hr->{tuid}
+			if $max_tuid{$hr->{uid}} < $hr->{tuid};
+		$uid_change_sum{$hr->{uid}} ||= 0; 
+		$uid_change_sum{$hr->{uid}} += abs(($hr->{value_old} || 1) - $hr->{value_new});
+	}
+	my $upvoteid   = $tagsdb->getTagnameidCreate($constants->{tags_upvote_tagname}   || 'nod');
+	my $downvoteid = $tagsdb->getTagnameidCreate($constants->{tags_downvote_tagname} || 'nix');
+	for my $uid (keys %uid_change_sum) {
+		my $tags_ar = $tagsdb->getAllTagsFromUser($uid);
+		for my $tag_hr (@$tags_ar) {
+			next unless $tag_hr->{tagnameid} == $upvoteid || $tag_hr->{tagnameid} == $downvoteid;
+			$globj_change{$tag_hr->{globjid}}{max_tuid} ||= $max_tuid{$uid};
+			$globj_change{$tag_hr->{globjid}}{max_tuid}   = $max_tuid{$uid}
+				if $globj_change{$tag_hr->{globjid}}{max_tuid} < $max_tuid{$uid};
+			$globj_change{$tag_hr->{globjid}}{sum} ||= 0;
+			$globj_change{$tag_hr->{globjid}}{sum} += $uid_change_sum{$uid};
+		}       
+	} 
+	my $ret_ar = [ ];
+	for my $globjid (sort { $a <=> $b } keys %globj_change) {
+		push @$ret_ar, {
+			tuid =>         $globj_change{$globjid}{max_tuid},
+			affected_id =>  $globjid,
+			importance =>   $globj_change{$globjid}{sum},
+		};      
+	}
 
-	return [ ];
+	main::tagboxLog("FireHoseScores->feed_userchanges returning " . scalar(@$ret_ar));
+	return $ret_ar;
 }
 
 sub run {

Modified: slashjp/trunk/tagboxes/FireHoseScores/mysql_dump.sql
===================================================================
--- slashjp/trunk/tagboxes/FireHoseScores/mysql_dump.sql	2007-10-18 14:07:12 UTC (rev 197)
+++ slashjp/trunk/tagboxes/FireHoseScores/mysql_dump.sql	2007-10-18 14:21:49 UTC (rev 198)
@@ -1,9 +1,11 @@
+# $Id: mysql_dump.sql,v 1.1 2007/09/28 03:33:20 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, 'FireHoseScores', 'globj', 2, 1, '2000-01-01 00:00:00', 0, 0, 0);
 
-INSERT INTO tagboxes (tbid, name, affected_type, clid, weight, last_run_completed, last_tagid_logged, last_tdid_logged, last_tuid_logged) VALUES (NULL, 'FHPopularity2', 'globj', 2, 1, '2000-01-01 00:00:00', 0, 0, 0);
-
 INSERT IGNORE INTO vars (name, value, description) VALUES ('tagbox_firehosescores_maxudcmult', '5', 'Maximum multiplier for an up/down tag based on the tags_udc table');
 INSERT IGNORE INTO vars (name, value, description) VALUES ('tagbox_firehosescores_udcbasis', '1000', 'Basis for tags_udc vote clout weighting');
 INSERT IGNORE INTO vars (name, value, description) VALUES ('tagbox_firehosescores_gracetime', '1200', 'Number of initial seconds of a firehose item life let it float higher in the hose');
 INSERT IGNORE INTO vars (name, value, description) VALUES ('tagbox_firehosescores_gracemult', '3', 'Multiplier factor for a firehose item during the grace period');
 INSERT IGNORE INTO vars (name, value, description) VALUES ('tagbox_firehosescores_gracevotes', '4', 'Max number of votes for which the grace period will apply');
 
+INSERT INTO tagbox_userkeyregexes VALUES ('FireHoseScores', '^tag_clout$');
+

Modified: slashjp/trunk/tagboxes/TagCountUser/TagCountUser.pm
===================================================================
--- slashjp/trunk/tagboxes/TagCountUser/TagCountUser.pm	2007-10-18 14:07:12 UTC (rev 197)
+++ slashjp/trunk/tagboxes/TagCountUser/TagCountUser.pm	2007-10-18 14:21:49 UTC (rev 198)
@@ -37,15 +37,12 @@
 sub new {
 	my($class, $user) = @_;
 
-	my $plugin = getCurrentStatic('plugin');
-	return undef if !$plugin->{Tags};
-	my($tagbox_name) = $class =~ /(\w+)$/;
-	my $tagbox = getCurrentStatic('tagbox');
-	return undef if !$tagbox->{$tagbox_name};
+	return 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;
@@ -57,6 +54,13 @@
 	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) = @_;
 	if (scalar(@$tags_ar) < 9) {

Modified: slashjp/trunk/tagboxes/Top/Top.pm
===================================================================
--- slashjp/trunk/tagboxes/Top/Top.pm	2007-10-18 14:07:12 UTC (rev 197)
+++ slashjp/trunk/tagboxes/Top/Top.pm	2007-10-18 14:21:49 UTC (rev 198)
@@ -37,15 +37,12 @@
 sub new {
 	my($class, $user) = @_;
 
-	my $plugin = getCurrentStatic('plugin');
-	return undef if !$plugin->{Tags};
-	my($tagbox_name) = $class =~ /(\w+)$/;
-	my $tagbox = getCurrentStatic('tagbox');
-	return undef if !$tagbox->{$tagbox_name};
+	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;
@@ -57,6 +54,13 @@
 	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();

Modified: slashjp/trunk/themes/slashcode/THEME
===================================================================
--- slashjp/trunk/themes/slashcode/THEME	2007-10-18 14:07:12 UTC (rev 197)
+++ slashjp/trunk/themes/slashcode/THEME	2007-10-18 14:21:49 UTC (rev 198)
@@ -160,6 +160,7 @@
 task=tasks/p2f_hof_topics.pl
 task=tasks/performance_stats.pl
 task=tasks/precache_gse.pl
+task=tasks/process_file_queue.pl
 task=tasks/refresh_authors_cache.pl
 task=tasks/refresh_section_metakeywords.pl
 task=tasks/report_slashd_errors.pl

Modified: slashjp/trunk/themes/slashcode/htdocs/users.pl
===================================================================
--- slashjp/trunk/themes/slashcode/htdocs/users.pl	2007-10-18 14:07:12 UTC (rev 197)
+++ slashjp/trunk/themes/slashcode/htdocs/users.pl	2007-10-18 14:21:49 UTC (rev 198)
@@ -2744,6 +2744,13 @@
 	my $clsmall_bonus = ($form->{clsmall_bonus} !~ /^[\-+]?\d+$/) ? 0 : $form->{clsmall_bonus};
 	my $clbig_bonus = ($form->{clbig_bonus} !~ /^[\-+]?\d+$/) ? 0 : $form->{clbig_bonus};
 
+	# plum
+	$form->{d2_comment_q} = (isSubscriber($user_edit) || $user_edit->{seclev} >= 100)
+		? $form->{d2_comment_q}
+		: ($form->{d2_comment_q} eq '0')
+			? 1
+			: $form->{d2_comment_q};
+
 	my $user_edits_table = {
 		discussion2		=> $form->{discussion2} || undef,
 		d2_comment_q		=> $form->{d2_comment_q} || undef,

Added: slashjp/trunk/themes/slashcode/tasks/process_file_queue.pl
===================================================================
--- slashjp/trunk/themes/slashcode/tasks/process_file_queue.pl	2007-10-18 14:07:12 UTC (rev 197)
+++ slashjp/trunk/themes/slashcode/tasks/process_file_queue.pl	2007-10-18 14:21:49 UTC (rev 198)
@@ -0,0 +1,142 @@
+#!/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: process_file_queue.pl,v 1.1 2007/10/16 22:59:52 tvroom Exp $
+
+use File::Path;
+use File::Temp;
+use File::Copy;
+use Slash::Constants ':slashd';
+
+use strict;
+
+use vars qw( %task $me $task_exit_flag );
+
+$task{$me}{timespec} = '* * * * *';
+$task{$me}{timespec_panic_1} = '* * * * *';
+$task{$me}{timespec_panic_2} = '';
+$task{$me}{on_startup} = 1;
+$task{$me}{fork} = SLASHD_NOWAIT;
+$task{$me}{code} = sub {
+	my($virtual_user, $constants, $slashdb, $user, $info, $gSkin) = @_;
+	
+	my $file_queue_cmds = [];
+	my $cmd;
+	while (!$task_exit_flag) {
+		if(!@$file_queue_cmds) {
+			$file_queue_cmds = $slashdb->getNextFileQueueCmds();
+		}
+		$cmd = shift @$file_queue_cmds;
+		if($cmd) {
+			handleFileCmd($cmd);
+		}
+		last if $task_exit_flag;
+		sleep(10);
+	}
+};
+
+sub handleFileCmd {
+	my($cmd) = @_;
+	my $slashdb = getCurrentDB();
+	if ($cmd->{action} eq "upload") {
+		uploadFile($cmd);
+	}
+	$slashdb->deleteFileQueueCmd($cmd->{fqid});
+	if (verifyFileLocation($cmd->{file})) {
+		unlink $cmd->{file};
+	}
+}
+
+sub getStoryFileDir {
+	my($sid) = @_;
+	my $bd = getCurrentStatic("basedir");
+	my $yearid  = substr($sid, 0, 2);
+	my $monthid = substr($sid, 3, 2);
+	my $dayid   = substr($sid, 6, 2);
+	my $path = catdir($bd, "images", "articles", $yearid, $monthid, $dayid);
+	return $path;
+}
+
+sub getFireHoseFileDir {
+	my($fhid) = @_;
+	my $bd = getCurrentStatic("basedir");
+	my ($numdir) = sprintf("%09d",$fhid);
+	my ($i,$j) = $numdir =~ /(\d\d\d)(\d\d\d)\d\d\d/;
+	my $path = catdir($bd, "images", "firehose", $i, $j);
+	return $path;
+}
+
+sub makeFileDir {
+	my($dir) = @_;
+	mkpath $dir, 0, 0775;
+}
+
+# verify any file we're copying or deleting meets our expectations
+sub verifyFileLocation {
+    my($file) = @_;
+    return $file =~ /^\/tmp\/upload\/\w+(\.\w+)?$/
+}
+
+sub uploadFile {
+	my($cmd) = @_;
+	my @suffixlist = ();
+	my $slashdb = getCurrentDB();
+	my $story = $slashdb->getStory($cmd->{stoid});
+	if ($story->{sid}) {
+		my $destpath = getStoryFileDir($story->{sid});
+		makeFileDir($destpath);
+		my ($prefix) = $story->{sid} =~ /^\d\d\/\d\d\/\d\d\/(\d+)$/;
+		
+		my ($name,$path,$suffix) = fileparse($cmd->{file}, @ suffixlist);
+	        ($suffix) = $name =~ /(\.\w+)$/;
+		if (verifyFileLocation($cmd->{file})) {
+			my $destfile = copyFileToLocation($cmd->{file}, $destpath, $prefix);
+			my $name = fileparse($destfile);
+			my $data = {
+				stoid => $cmd->{stoid},
+				name => $name
+			};
+
+			$slashdb->addStoryStaticFile($data);
+		}
+
+	}
+	if ($cmd->{fhid}) {
+		my $destpath = getFireHoseFileDir($cmd->{fhid});
+		makeFileDir($destpath);
+		my $numdir = sprintf("%09d",$cmd->{fhid});
+		my ($prefix) = $numdir =~ /\d\d\d\d\d\d(\d\d\d)/;
+		copyFileToLocation($cmd->{file}, $destpath, $prefix);
+	}
+}
+
+sub copyFileToLocation {
+	my ($srcfile,  $destpath, $prefix) = @_;
+	slashdLog("$srcfile | $destpath | $prefix\n");
+	my @suffixlist;
+	my ($name,$path,$suffix) = fileparse($srcfile, @suffixlist);
+	($suffix) = $name =~ /(\.\w+)$/;
+	$suffix = lc($suffix);
+	my $destfile;
+	my $foundfile = 0;
+	my $i = 1;
+	my $ret_val = "";
+	while(!$foundfile && $i < 20) {
+		$destfile  = $destpath . "/". $prefix . "-$i" . $suffix;
+		if (!-e $destfile) {
+			$foundfile = 1;
+		} else {
+			$i++;
+		}
+	}
+	if ($foundfile) {
+		copy($srcfile, $destfile);
+		$ret_val = $destfile;
+	} else {
+		slashdLog("Couldn't save file to dir - too many already exist");
+	}
+	return $ret_val;
+}
+
+1;

Modified: slashjp/trunk/themes/slashcode/templates/editComm;users;default
===================================================================
--- slashjp/trunk/themes/slashcode/templates/editComm;users;default	2007-10-18 14:07:12 UTC (rev 197)
+++ slashjp/trunk/themes/slashcode/templates/editComm;users;default	2007-10-18 14:21:49 UTC (rev 198)
@@ -64,9 +64,10 @@
 		[% IF user_edit.discussion2 && user_edit.discussion2 == "slashdot" %]
 		<blockquote><div>
 		How Many Comments
-		[% comment_q = Slash.db.getDescriptions('d2_comment_q');
-		   comment_q_def = user_edit.d2_comment_q || 0;
-		   Slash.createSelect('d2_comment_q', comment_q, comment_q_def, 1) %]<br>
+		[% comment_q_name = ( Slash.isSubscriber(user_edit) || (user_edit.seclev >= 100) ) ? 'd2_comment_q_all' : 'd2_comment_q';
+		   comment_q = Slash.db.getDescriptions(comment_q_name);
+		   Slash.createSelect('d2_comment_q', comment_q, user_edit.d2_comment_q, 1) %]<br>
+
 		Comment Retrieval Order
 		[% comment_order = Slash.db.getDescriptions('d2_comment_order');
 		   comment_order_def = user_edit.d2_comment_order || 0;

Modified: slashjp/trunk/themes/slashcode/templates/printCommentsMain;misc;default
===================================================================
--- slashjp/trunk/themes/slashcode/templates/printCommentsMain;misc;default	2007-10-18 14:07:12 UTC (rev 197)
+++ slashjp/trunk/themes/slashcode/templates/printCommentsMain;misc;default	2007-10-18 14:21:49 UTC (rev 198)
@@ -186,7 +186,7 @@
    		return_url = gSkin.rootdir _ '/comments.pl?sid=' _ sid %]
         <a href="[% gSkin.rootdir %]/login.pl" onclick="show_login_box(); return false">Login</a>
     [% ELSE %]
-        <a href="[% gSkin.rootdir %]/my/comments"[% IF constants.modal_prefs_active %] onclick="getModalPrefs('d2'); return false"[% END %]>Prefs</a>
+        <a href="[% gSkin.rootdir %]/my/comments"[% IF constants.modal_prefs_active %] onclick="getModalPrefs('d2', 'Discussion 2'); return false"[% END %]>Prefs</a>
     [% END %]
 
 		[% UNLESS user.state.discussion_archived || user.state.discussion_future_nopost %]
@@ -272,7 +272,7 @@
    		return_url = gSkin.rootdir _ '/comments.pl?sid=' _ sid %]
         <a href="[% gSkin.rootdir %]/login.pl" onclick="show_login_box(); return false">Login</a>
     [% ELSE %]
-        <a href="[% gSkin.rootdir %]/my/comments"[% IF constants.modal_prefs_active %] onclick="getModalPrefs('d2'); return false"[% END %]>Prefs</a>
+        <a href="[% gSkin.rootdir %]/my/comments"[% IF constants.modal_prefs_active %] onclick="getModalPrefs('d2', 'Discussion 2'); return false"[% END %]>Prefs</a>
     [% END %]
 		[% UNLESS user.state.discussion_archived || user.state.discussion_future_nopost %]
 			| [% Slash.linkComment({
@@ -296,7 +296,7 @@
 <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>Modify Your Preferences <a href="javascript:hide_modal_box()"><img src="[% gSkin.imagedir %]/images/sic_close.png" alt="Close"></a></h3></div>
+                <div class="title"><h3><div id="preference_title"></div> <a href="javascript:hide_modal_box()"><img src="[% gSkin.imagedir %]/images/sic_close.png" alt="Close"></a></h3></div>
         </div>
         <div id="modal_box_content">Content here</div>
 </div>


Slashdotjp-dev メーリングリストの案内
アーカイブの一覧に戻る