a couple little tweaks
This commit is contained in:
parent
5477108b9b
commit
45788efd32
3 changed files with 14 additions and 8 deletions
|
|
@ -43,6 +43,13 @@ sub isModerator {
|
|||
return WebGUI::Privilege::isInGroup($self->get("groupToModerate"), $userId);
|
||||
}
|
||||
|
||||
sub isSubscribed {
|
||||
my ($self, $userId) = @_;
|
||||
$userId = $session{user}{userId} unless ($userId);
|
||||
my ($isSubscribed) = WebGUI::SQL->quickArray("select count(*) from forumSubscription where forumId=".$self->get("forumId")." and userId=$userId");
|
||||
return $isSubscribed;
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($self, $forumId) = @_;
|
||||
my $properties = WebGUI::SQL->getRow("forum","forumId",$forumId);
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ sub getThread {
|
|||
sub hasRated {
|
||||
my ($self, $userId, $ipAddress) = @_;
|
||||
$userId = $session{user}{userId} unless ($userId);
|
||||
return 1 if ($userId != 1 && $userId == $self->get("userId")); # is poster
|
||||
$ipAddress = $session{env}{REMOTE_ADDR} unless ($ipAddress);
|
||||
my ($flag) = WebGUI::SQL->quickArray("select count(*) from forumPostRating where forumPostId="
|
||||
.$self->get("forumPostId")." and ((userId=$userId and userId<>1) or (userId=1 and
|
||||
|
|
|
|||
|
|
@ -288,6 +288,7 @@ sub www_post {
|
|||
$var->{'form.begin'} = WebGUI::Form::formHeader({
|
||||
action=>$callback
|
||||
});
|
||||
my $defaultSubscribeValue = 0;
|
||||
if ($var->{isReply}) {
|
||||
my $reply = WebGUI::Forum::Post->new($session{form}{parentId});
|
||||
return WebGUI::Privilege::insufficient unless ($reply->getThread->getForum->canPost);
|
||||
|
|
@ -300,10 +301,6 @@ sub www_post {
|
|||
|
||||
$subject = $reply->get("subject");
|
||||
$subject = "Re: ".$subject unless ($subject =~ /^Re:/);
|
||||
$var->{'subscribe.form'} = WebGUI::Form::yesNo({
|
||||
name=>'subscribe',
|
||||
value=>0
|
||||
});
|
||||
}
|
||||
if ($var->{isNewThread}) {
|
||||
$var->{'form.begin'} .= WebGUI::Form::hidden({
|
||||
|
|
@ -319,10 +316,7 @@ sub www_post {
|
|||
value=>0
|
||||
});
|
||||
}
|
||||
$var->{'subscribe.form'} = WebGUI::Form::yesNo({
|
||||
name=>'subscribe',
|
||||
value=>1
|
||||
});
|
||||
$defaultSubscribeValue = 1 unless ($forum->isSubscribed);
|
||||
}
|
||||
if ($var->{isNewMessage}) {
|
||||
$var->{'subscribe.label'} = WebGUI::International::get(873);
|
||||
|
|
@ -333,6 +327,10 @@ sub www_post {
|
|||
value=>0
|
||||
});
|
||||
}
|
||||
$var->{'subscribe.form'} = WebGUI::Form::yesNo({
|
||||
name=>'subscribe',
|
||||
value=>$defaultSubscribeValue
|
||||
});
|
||||
}
|
||||
if ($var->{isEdit}) {
|
||||
my $post = WebGUI::Forum::Post->new($session{form}{forumPostId});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue