add ad management system

improved performance of cs threads by about 500%
This commit is contained in:
JT Smith 2006-04-05 03:42:14 +00:00
parent c8956ac0c5
commit d26f1bdd8c
11 changed files with 740 additions and 74 deletions

View file

@ -434,7 +434,7 @@ Returns a boolean indicating whether this thread is marked read for the user.
sub isMarkedRead {
my $self = shift;
return 1 if $self->isPoster;
my ($isRead) = $self->session->db->quickArray("select count(*) from Post_read where userId=".$self->session->db->quote($self->session->user->userId)." and threadId=".$self->session->db->quote($self->getId)." and postId=".$self->session->db->quote($self->get("lastPostId")));
my ($isRead) = $self->session->db->quickArray("select count(*) from Thread_read where threadId=? and userId=?",[$self->getId,$self->session->user->userId]);
return $isRead;
}
@ -479,6 +479,19 @@ sub lock {
}
#-------------------------------------------------------------------
=head2 markRead ( )
Marks this post read for this user.
=cut
sub markRead {
my $self = shift;
$self->session->db->write("replace into Thread_read (threadId, userId) values (?,?)",[$self->getId,$self->session->user->userId]);
}
#-------------------------------------------------------------------
=head2 prepareView ( )
@ -512,6 +525,12 @@ sub processPropertiesFromFormPost {
}
}
#-------------------------------------------------------------------
sub purge {
my $self = shift;
$self->session->db->write("delete from Thread_read where postId=?",[$self->getId]);
return $self->SUPER::purge;
}
#-------------------------------------------------------------------
@ -673,6 +692,19 @@ sub unlock {
#-------------------------------------------------------------------
=head2 unmarkRead ( )
unmarks this post read for all users.
=cut
sub unmarkRead {
my $self = shift;
$self->session->db->write("delete from Thread_read where threadId=?",[$self->getId]);
}
#-------------------------------------------------------------------
=head2 unstick ( )
Negates the stick method.