gustafn
committed
on 28 Jun 15
- modernize Tcl
- standardize url construction to protect against injection attacks
openacs-4/.../dotlrn/www/register.tcl (+2 -2)
73 73
74 74 if {[catch {
75 75     switch -exact $join_policy {
76 76         "open" {
77 77             dotlrn_community::add_user -member_state approved $community_id $user_id
78 78             dotlrn_community::send_member_email -community_id $community_id -to_user $user_id
79 79         }
80 80         "needs approval" {
81 81             dotlrn_community::add_user -member_state "needs approval" $community_id $user_id
82 82
83 83
84 84             # Following the same process as spam.tcl to email
85 85             # admins in bulk.
86 86
87 87             set segment_id [db_string select_admin_rel_segment_id {}]
88 88             set community_name [dotlrn_community::get_community_name $community_id]
89 89             set community_url "[parameter::get -package_id [ad_acs_kernel_id] -parameter SystemURL][dotlrn_community::get_community_url $community_id]"
90 90
91 91             set query [db_map bulk_mail_query]
92 92
93               set full_name [person::name -user_id $user_id]
  93             set full_name [person::name -person_id $user_id]
94 94             set email [party::email -party_id $user_id]
95 95             set subject "$full_name ($email) has requested to join $community_name."
96 96
97 97             set message "$full_name ($email) has requested to join $community_name.
98 98            
99 99 Visit this link to approve or reject this request:
100 100 $community_url/members
101 101
102 102         "
103 103
104 104             set package_id [site_node_apm_integration::get_child_package_id \
105 105                                 -package_id [dotlrn_community::get_package_id $community_id] \
106 106                                 -package_key [bulk_mail::package_key]]
107 107
108 108             bulk_mail::new \
109 109                     -package_id $package_id \
110 110                     -from_addr [ad_system_owner] \
111 111                     -subject $subject \
112 112                     -message $message \
113 113                     -query $query