Made kwote lines that begin with spaces converted to
Added configuration parameter for rating that kills a kwote
This commit is contained in:
parent
bf921de540
commit
b6ef5ff5a5
@ -1,5 +1,8 @@
|
||||
10-15-2005
|
||||
* Made kwote lines that begin with spaces converted to
|
||||
* Added configuration parameter for rating that kills a kwote
|
||||
|
||||
10-10-2004
|
||||
* Added kwote_backup table.
|
||||
* Implemented functionality to remove nagative kwotes.
|
||||
|
||||
|
||||
|
@ -48,16 +48,18 @@ sub cleanup {
|
||||
# backup kwotes to be deleted
|
||||
my $sth = $dbh->prepare(
|
||||
"INSERT INTO kwote_backup SELECT * FROM kwote WHERE ".
|
||||
"(now()-submit_dt)>? AND rating<0"
|
||||
"(now()-submit_dt)>? AND rating<=?"
|
||||
);
|
||||
$sth->bind_param(1, NEGATIVE_KWOTE_TTL);
|
||||
$sth->bind_param(2, KWOTE_DEATH_RATING);
|
||||
$sth->execute() or die "Couldn't backup kwotes";
|
||||
|
||||
# delete kwotes
|
||||
$sth = $dbh->prepare(
|
||||
"DELETE FROM kwote WHERE (now()-submit_dt)>? AND rating<0"
|
||||
"DELETE FROM kwote WHERE (now()-submit_dt)>? AND rating<=?"
|
||||
);
|
||||
$sth->bind_param(1, NEGATIVE_KWOTE_TTL);
|
||||
$sth->bind_param(2, KWOTE_DEATH_RATING);
|
||||
$sth->execute() or die "Couldn't delete kwotes";
|
||||
|
||||
# delete the vote log (this doesn't affect kwote rating)
|
||||
@ -268,11 +270,15 @@ sub get_db_connection {
|
||||
# Escape html
|
||||
sub html_escape {
|
||||
my ($data) = @_;
|
||||
$data =~ s/</</g;
|
||||
$data =~ s/>/>/g;
|
||||
$data =~ s/\n/<br \/>/g;
|
||||
$data =~ s/"/"/g;
|
||||
return $data;
|
||||
my $ret_data = "";
|
||||
foreach my $line (split(/\n/,$data)) {
|
||||
$line =~ s/</</g;
|
||||
$line =~ s/>/>/g;
|
||||
$line =~ s/"/"/g;
|
||||
$line =~ s/^\s+/" "x$+[0]/e;
|
||||
$ret_data .= "$line<br />";
|
||||
}
|
||||
return $ret_data;
|
||||
}
|
||||
|
||||
##
|
||||
|
@ -7,31 +7,38 @@ use constant {
|
||||
|
||||
DB_NAME => "kwotes", # database name
|
||||
|
||||
DB_HOST => "localhost", # database host
|
||||
DB_HOST => "127.0.0.1", # database host
|
||||
|
||||
DB_USER => "kwotes", # database user
|
||||
|
||||
DB_PASS => "kw0tes", # database password
|
||||
|
||||
MAX_VOTES_PER_IP => 4, # maximum votes per ip address per
|
||||
# VOTE_TTL seconds.
|
||||
|
||||
MAX_KWOTES_PER_IP => 5, # maximum kwotes allowed per ip
|
||||
# in SECS_BETWEEN_KWOTES
|
||||
|
||||
SECS_BETWEEN_KWOTES => 60*60, # seconds a user must wait after
|
||||
# submitting MAX_KWOTES_PER_IP
|
||||
# kwotes to the system before they
|
||||
# are allowed to submit another
|
||||
# kwote
|
||||
|
||||
KWOTE_DEATH_RATING => -1, # lowest rating a quote can be
|
||||
# before it's deleted. A kwote is
|
||||
# only deleted if it's been this
|
||||
# number (or lower) for longer than
|
||||
# the KWOTE_TTL
|
||||
|
||||
NEGATIVE_KWOTE_TTL => (60*60)*24, # seconds before a negative rated
|
||||
KWOTE_TTL => (60*60)*24, # seconds before a "dead"
|
||||
# quote is moved to the kwote
|
||||
# backup table and deleted
|
||||
|
||||
VOTE_TTL => (60*60)*24 # seconds a vot log lasts, the vote
|
||||
VOTE_TTL => (60*60)*24, # seconds a vote log lasts, the vote
|
||||
# log is the mechanism that keeps
|
||||
# people from voting over and over
|
||||
|
||||
MAX_VOTES_PER_IP => 4, # maximum votes per ip address per
|
||||
# VOTE_TTL seconds.
|
||||
|
||||
MAX_KWOTES_PER_IP => 5 # maximum kwotes allowed per ip
|
||||
# in SECS_BETWEEN_KWOTES
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
|
Loading…
Reference in New Issue
Block a user