merging 5.5.5 bugfixes

This commit is contained in:
JT Smith 2004-03-04 05:56:44 +00:00
parent 3a845e9027
commit cbbb7e8392
15 changed files with 2764 additions and 10 deletions

View file

@ -82,7 +82,7 @@ sub canEdit {
my ($self, $userId) = @_;
$userId = $session{user}{userId} unless ($userId);
return ($self->getThread->getForum->isModerator || ($self->get("userId") == $userId && $userId != 1
&& $self->getThread->getForum->get("editTimeout") < (WebGUI::DateTime::time() - $self->get("dateOfPost"))));
&& $self->getThread->getForum->get("editTimeout") > (WebGUI::DateTime::time() - $self->get("dateOfPost"))));
}
#-------------------------------------------------------------------

View file

@ -419,6 +419,7 @@ sub setLastPost {
lastPostId=>$postId,
lastPostDate=>$postDate
});
$self->getForum->setLastPost($postDate, $postId);
}
#-------------------------------------------------------------------

View file

@ -1645,7 +1645,7 @@ A hash reference containing information passed from the calling object.
sub www_deletePostConfirm {
my ($caller) = @_;
my $post = WebGUI::Forum::Post->new($session{form}{forumPostId});
return WebGUI::Privilege::insufficient() unless ($post->getThread->getForum->isModerator);
return WebGUI::Privilege::insufficient() unless ($post->canEdit);
$post->setStatusDeleted;
return www_viewForum($caller,$post->getThread->get("forumId"));
}
@ -1827,7 +1827,7 @@ sub www_post {
name=>'subscribe',
value=>$defaultSubscribeValue
});
$message .= "\n\n".$session{user}{signature};
$message .= "\n\n".$session{user}{signature} if ($session{user}{signature});
}
if ($var->{'newpost.isEdit'}) {
my $post = WebGUI::Forum::Post->new($session{form}{forumPostId});
@ -2306,6 +2306,12 @@ sub www_viewThread {
my ($caller, $postId) = @_;
WebGUI::Session::setScratch("forumThreadLayout",$session{form}{layout});
$postId = $session{form}{forumPostId} unless ($postId);
# If POST, cause redirect, so new post is displayed using GET instead of POST
if ($session{env}{REQUEST_METHOD} =~ /POST/i) {
my $url= formatThreadURL($caller-> {callback}, $postId);
$session{header}{redirect} = WebGUI::Session::httpRedirect($url);
return "";
}
my $post = WebGUI::Forum::Post->new($postId);
return WebGUI::Privilege::insufficient() unless ($post->getThread->getForum->canView);
my $var = getThreadTemplateVars($caller, $post);