Update of /cvs/scoop/scoop/lib/Scoop
In directory lithium.sabren.com:/tmp/cvs-serv30410/lib/Scoop

Modified Files:
	Comments.pm 
Log Message:
Bugs 71, 159, 161.

* replacing deleted comments with placeholder text (in addition to normal delete)
* updates to Bundle::Scoop to make it current
* default favicon.ico and robots.txt

-janra



Index: Comments.pm
===================================================================
RCS file: /cvs/scoop/scoop/lib/Scoop/Comments.pm,v
retrieving revision 1.131
retrieving revision 1.132
diff -C2 -d -r1.131 -r1.132
*** Comments.pm	4 Aug 2004 21:49:47 -0000	1.131
--- Comments.pm	27 Jan 2005 19:37:16 -0000	1.132
***************
*** 67,75 ****
  			$S->_delete_comment($sid, $cid, $pid);
  		} else {
! 			$delete_confirm = $S->_confirm_delete_comment($sid, $cid);
  		}
  	}
  	
! 	if ( ($tool eq 'toggle_normal' || $tool eq 'toggle_editorial') && $S->have_perm( 'comment_delete' )) {
  		$S->comment_toggle_pending($sid, $cid, $tool);
  	}
--- 67,82 ----
  			$S->_delete_comment($sid, $cid, $pid);
  		} else {
! 			$delete_confirm = $S->_confirm_delete_comment($sid, $cid, $tool);
! 		}
! 	}
! 	if ($tool eq 'remove' && $S->have_perm( 'comment_remove' )) {
! 		if ($S->{CGI}->param('confirm') eq 'delete') {
! 			$S->_remove_comment($sid, $cid, $pid);
! 		} else {
! 			$delete_confirm = $S->_confirm_delete_comment($sid, $cid, $tool);
  		}
  	}
  	
! 	if ( ($tool eq 'toggle_editorial' || $tool eq 'toggle_normal') && $S->have_perm( 'comment_toggle' )) {
  		$S->comment_toggle_pending($sid, $cid, $tool);
  	}
***************
*** 265,271 ****
  sub _confirm_delete_comment {
  	my $S = shift;
! 	my ($sid, $cid) = @_;
  
! 	return qq~%%norm_font%%To actually delete this comment, <a href="%%rootdir%%/comments/$sid/$cid/delete?confirm=delete">click here</a>.%%norm_font_end%%~;
  }
  
--- 272,278 ----
  sub _confirm_delete_comment {
  	my $S = shift;
! 	my ($sid, $cid, $tool) = @_;
  
! 	return qq~%%norm_font%%To actually delete this comment, <a href="%%rootdir%%/comments/$sid/$cid/$tool?confirm=delete">click here</a>.%%norm_font_end%%~;
  }
  
***************
*** 278,288 ****
  	$S->run_hook('comment_delete', $sid, $cid);
  
  	# First, get the uid of comment poster
- 	my $quoted_sid = $S->dbh->quote($sid);
  	my ($rv, $sth) = $S->db_select({
  		ARCHIVE => $S->_check_archivestatus($sid),
  		WHAT => 'uid',
  		FROM => 'comments',
! 		WHERE => qq|cid = "$cid" AND sid = $quoted_sid|});
  	
  	my $uid = $sth->fetchrow();
--- 285,298 ----
  	$S->run_hook('comment_delete', $sid, $cid);
  
+ 	my $q_sid = $S->dbh->quote($sid);
+ 	my $q_cid = $S->dbh->quote($cid);
+ 	my $q_pid = $S->dbh->quote($pid);
+ 
  	# First, get the uid of comment poster
  	my ($rv, $sth) = $S->db_select({
  		ARCHIVE => $S->_check_archivestatus($sid),
  		WHAT => 'uid',
  		FROM => 'comments',
! 		WHERE => qq|cid = $q_cid AND sid = $q_sid|});
  	
  	my $uid = $sth->fetchrow();
***************
*** 292,296 ****
  		ARCHIVE => $S->_check_archivestatus($sid),
  		FROM => 'comments',
! 		WHERE => qq|cid = "$cid" AND sid = $quoted_sid|});
  	
  	return unless ($rv);
--- 302,306 ----
  		ARCHIVE => $S->_check_archivestatus($sid),
  		FROM => 'comments',
! 		WHERE => qq|cid = $q_cid AND sid = $q_sid|});
  	
  	return unless ($rv);
***************
*** 300,305 ****
  		ARCHIVE => $S->_check_archivestatus($sid),
  		WHAT => 'comments',
! 		SET => qq|pid = $pid|,
! 		WHERE => qq|sid = $quoted_sid AND pid = '$cid'|});
  	
  	# Drop ratings for comment and recalculate mojo
--- 310,315 ----
  		ARCHIVE => $S->_check_archivestatus($sid),
  		WHAT => 'comments',
! 		SET => qq|pid = $q_pid|,
! 		WHERE => qq|sid = $q_sid AND pid = $q_cid|});
  	
  	# Drop ratings for comment and recalculate mojo
***************
*** 309,312 ****
--- 319,368 ----
  	$S->_count_cache_drop($sid);
  	
+ 	
+ 	# Ok, now we've done it up right.
+ 	return 1;
+ }
+ 
+ # Instead of completely deleting a comment, replace it with a 
+ # comment saying that the comment was deleted
+ sub _remove_comment {
+ 	my $S = shift;
+ 	my ($sid, $cid, $pid) = @_;
+ 	
+ 	$pid = 0 unless $pid;
+ 	return unless $S->have_perm('comment_remove');
+ 
+ 	$S->run_hook('comment_delete', $sid, $cid);
+ 
+ 	my $removed_body = $S->{UI}->{BLOCKS}->{removed_comment_body};
+ 	my $removed_subject = $S->{UI}->{BLOCKS}->{removed_comment_subject};
+ 	$removed_body =~ s/%%nick%%/$S->{NICK}/g;
+ 	$removed_subject =~ s/%%nick%%/$S->{NICK}/g;
+ 	$removed_body = $S->dbh->quote($removed_body);
+ 	$removed_subject = $S->dbh->quote($removed_subject);
+ 
+ 	my $q_sid = $S->dbh->quote($sid);
+ 	my $q_cid = $S->dbh->quote($cid);
+ 	my $q_pid = $S->dbh->quote($pid);
+ 
+ 	# Then "delete" the comment
+ 	my ($rv, $sth) = $S->db_update({
+ 		ARCHIVE => $S->_check_archivestatus($sid),
+ 		WHAT => 'comments',
+ 		SET => qq|comment = $removed_body, subject = $removed_subject|,
+ 		WHERE => qq|cid = $q_cid AND sid = $q_sid|});
+ 	
+ 	return unless ($rv);
+ 	# First, get the uid of comment poster
+ 	($rv, $sth) = $S->db_select({
+ 		ARCHIVE => $S->_check_archivestatus($sid),
+ 		WHAT => 'uid',
+ 		FROM => 'comments',
+ 		WHERE => qq|cid = $q_cid AND sid = $q_sid|});
+ 	
+ 	my $uid = $sth->fetchrow();
+ 	
+ 	# Drop ratings for comment and recalculate mojo
+ 	$S->_delete_ratings($sid, $cid, $uid);
  	
  	# Ok, now we've done it up right.