bboard_get_topic_infoWhat it does:
Find info about a topic. if {[exists_and_not_null topic_id]} { validate_integer "topic_id" $topic_id }Defined in: /web/philip/tcl/bboard-defs.tcl
Source code:
uplevel { if {!([exists_and_not_null topic_id] && ![catch {set selection [ns_db 1row $db "select t.*, u.email as maintainer_email, u.first_names || ' ' || u.last_name as maintainer_name, primary_maintainer_id from bboard_topics t, users u where topic_id=$topic_id and t.primary_maintainer_id = u.user_id"]} errmsg]) && !([exists_and_not_null topic] && ![catch {set selection [ns_db 1row $db "select t.*, u.email as maintainer_email, u.first_names || ' ' || u.last_name as maintainer_name, primary_maintainer_id from bboard_topics t, users u where topic = '[DoubleApos $topic]' and t.primary_maintainer_id = u.user_id"]} errmsg]) } { # Note that we didn't use QQtopic above because some # of the pages in bboard call set_form_variables # (instead of set_the_usual_form_variables) # which does not set a QQ variable bboard_return_cannot_find_topic_page return -1 } set_variables_after_query set user_id [ad_verify_and_get_user_id] # Check read-access of this topic if {[string compare $read_access "any"] == 0} { # Any user can view this topic return 1 } elseif {[string compare $read_access "public"] == 0} { # "public" means user must be logged in to read this topic if {$user_id == 0} { ad_returnredirect /register?return_url=[ns_urlencode "[bboard_hardwired_url_stub]admin-home?[export_url_vars topic_id]"] return -1 } else { return 1 } } elseif {[string compare $read_access "group"] == 0} { # "group" means the user must belong to one of the topic's groups. # branimir 2000-02-04 # lars 2000-04-27: first we check the group associated with the topic if {[ad_user_group_member $db $group_id $user_id]} { ns_db flush $db return 1 } # Check if user belongs to any of topic's groups in adminstration_info if {[ad_permission_p $db bboard $topic_id "" $user_id]} { ns_db flush $db return 1 } else { # Well, the user isn't in any of the topic's groups. But.. # If they are site admin group member, let's let them in anyway. # default to group is private (read_access = group) if {[ad_administration_group_member $db "site_wide" "" $user_id]} { # user is site admin, let them look at the bboard return 1 } else { ns_return 200 text/html "[bboard_header "Unauthorized"] <h2>Unauthorized</h2> <hr> You are either not logged into <A href=\"[ad_url]\">[ad_system_name]</a> or not authorized to view the $topic forum. [bboard_footer]" return -1 } } } }