merging 5.5.5 bugfixes
This commit is contained in:
parent
3a845e9027
commit
cbbb7e8392
15 changed files with 2764 additions and 10 deletions
|
|
@ -51,6 +51,7 @@ Data management class for forums.
|
|||
$forum->purge;
|
||||
$forum->recalculateRating;
|
||||
$forum->set(\%data);
|
||||
$forum->setLastPost($epoch, $postId);
|
||||
$forum->subscribe;
|
||||
$forum->unsubscribe;
|
||||
|
||||
|
|
@ -444,6 +445,34 @@ sub set {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setLastPost ( lastPostDate, lastPostId )
|
||||
|
||||
Sets the pertinent details for the last post. Can also be done directly using the set method.
|
||||
|
||||
=over
|
||||
|
||||
=item lastPostDate
|
||||
|
||||
The epoch date of the post.
|
||||
|
||||
=item lastPostId
|
||||
|
||||
The unique id of the post.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
sub setLastPost {
|
||||
my ($self, $postDate, $postId) = @_;
|
||||
$self->set({
|
||||
lastPostId=>$postId,
|
||||
lastPostDate=>$postDate
|
||||
});
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 subscribe ( [ userId ] )
|
||||
|
||||
Subscribes a user to this forum.
|
||||
|
|
|
|||
|
|
@ -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"))));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -419,6 +419,7 @@ sub setLastPost {
|
|||
lastPostId=>$postId,
|
||||
lastPostDate=>$postDate
|
||||
});
|
||||
$self->getForum->setLastPost($postDate, $postId);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ sub format {
|
|||
$content =~ s/\n/\<br \/\>/g;
|
||||
$content =~ s/\t/ /g;
|
||||
$content =~ s/ / /g;
|
||||
$content = '<div style="font-family: fixed;">'.$content.'</div>';
|
||||
$content = '<div style="font-family: monospace;">'.$content.'</div>';
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -366,7 +366,7 @@ sub www_manageGroupsInGroup {
|
|||
$f = WebGUI::HTMLForm->new;
|
||||
$f->hidden("op","addGroupsToGroupSave");
|
||||
$f->hidden("gid",$session{form}{gid});
|
||||
$groups = WebGUI::Grouping::getGroupsInGroup($session{form}{gid});
|
||||
$groups = WebGUI::Grouping::getGroupsInGroup($session{form}{gid},1);
|
||||
push(@$groups,$session{form}{gid});
|
||||
$f->group(
|
||||
-name=>"groups",
|
||||
|
|
|
|||
|
|
@ -560,7 +560,7 @@ sub www_editPageSave {
|
|||
title => $session{form}{title},
|
||||
styleId => $session{form}{styleId},
|
||||
printableStyleId => $session{form}{printableStyleId},
|
||||
ownerId => $session{form}{ownerId},
|
||||
ownerId => ($session{form}{ownerId} || 3),
|
||||
groupIdView => $session{form}{groupIdView},
|
||||
groupIdEdit => $session{form}{groupIdEdit},
|
||||
newWindow => $session{form}{newWindow},
|
||||
|
|
|
|||
|
|
@ -319,11 +319,16 @@ sub httpHeader {
|
|||
if ($session{header}{filename} && $session{header}{mimetype} eq "text/html") {
|
||||
$session{header}{mimetype} = "application/octet-stream";
|
||||
}
|
||||
if ($session{setting}{preventProxyCache}) {
|
||||
$session{header}{expires} = "-1d";
|
||||
}
|
||||
return $session{cgi}->header(
|
||||
-type => $session{header}{mimetype}.'; charset='.$session{header}{charset},
|
||||
-type => $session{header}{mimetype}
|
||||
-charset => $session{header}{charset},
|
||||
-cookie => $session{header}{cookie},
|
||||
-status => $session{header}{status},
|
||||
-attachment => $session{header}{filename}
|
||||
-attachment => $session{header}{filename},
|
||||
-expires => $session{header}{expires}
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -189,7 +189,11 @@ sub print {
|
|||
my $tabs;
|
||||
my $form;
|
||||
foreach my $key (keys %{$_[0]->{_tab}}) {
|
||||
$tabs .= '<span onclick="toggleTab('.$i.')" id="tab'.$i.'" class="tab">'.$_[0]->{_tab}{$key}{label}.'</span> ';
|
||||
$tabs .= '<span onclick="toggleTab('.$i.')" id="tab'.$i.'" class="tab"';
|
||||
if ($_[0]->{_tab}->{$key}{uiLevel} > $session{user}{uiLevel}) {
|
||||
$tabs .= 'style="display: none;"';
|
||||
}
|
||||
$tabs .= '>'.$_[0]->{_tab}{$key}{label}.'</span> ';
|
||||
$form .= '<div id="tabcontent'.$i.'" class="tabBody"><table>';
|
||||
$form .= $_[0]->{_tab}{$key}{form}->printRowsOnly;
|
||||
$form .= '</table></div>';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue