Index: openacs-4/packages/forums/www/message-post.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/message-post.tcl,v diff -u -r1.48 -r1.49 --- openacs-4/packages/forums/www/message-post.tcl 7 Jun 2018 18:08:11 -0000 1.48 +++ openacs-4/packages/forums/www/message-post.tcl 3 Sep 2024 15:37:39 -0000 1.49 @@ -7,25 +7,20 @@ @cvs-id $Id$ } -query { - {forum_id:integer ""} - {parent_id:integer ""} + {forum_id:object_type(forums_forum) ""} + {parent_id:object_type(forums_message) ""} } -validate { forum_id_or_parent_id { if {$forum_id eq "" && $parent_id eq ""} { ad_complain [_ forums.lt_You_either_have_to] } - if {$forum_id ne "" && ![forum::valid_forum_id_p -forum_id $forum_id]} { - ad_complain [_ acs-templating.Invalid_integer] - } - if {$parent_id ne ""} { - forum::message::get -message_id $parent_id -array parent_message - if {![info exists parent_message]} { - ad_complain [_ acs-templating.Invalid_integer] - } - } } } +if {$parent_id ne ""} { + forum::message::get -message_id $parent_id -array parent_message +} + if { [ns_queryget formbutton:post] ne "" } { set action post } elseif { [ns_queryget formbutton:preview] ne "" } { @@ -40,11 +35,12 @@ ############################## # Pull out required forum and parent data and -# perform security checks +# perform security checks. # if {$parent_id eq ""} { - # no parent_id, therefore new thread - # require thread creation privs + # No parent_id was specified, therefore, we need the forums info + # to check permissions ant to check the forums settings, whether + # new threads are allowed in general. forum::get -forum_id $forum_id -array forum if { ![permission::permission_p -object_id $forum_id -privilege "forum_moderate"] } { @@ -75,9 +71,11 @@ && ($parent_id eq "" || [forum::security::can_post_forum_p \ -forum_id $parent_message(forum_id) -user_id 0])}] +if {$forum_id eq ""} { + set forum_id $parent_message(forum_id) +} +set attachments_enabled_p [forum::attachments_enabled_p -forum_id $forum_id] -set attachments_enabled_p [forum::attachments_enabled_p] - ############################## # Template variables #