@@ -98,7 +98,7 @@ function os2web_print_send_to_friend_send_to_friend_form($bullet_point_id) {
98
98
99
99
function os2web_print_send_to_friend_bullet_point_access($bullet_point_id) {
100
100
$bullet_point = node_load($bullet_point_id);
101
-
101
+
102
102
if (strcmp($bullet_point->type, 'bullet_point') == 0) {
103
103
if ($bullet_point->field_bul_point_closed['und'][0]['value'])
104
104
return TRUE;
@@ -115,46 +115,38 @@ function os2web_print_send_to_friend_bullet_point_access($bullet_point_id) {
115
115
* @patam string $email email
116
116
*
117
117
*/
118
- function os2web_print_send_to_friend_send_to_friend($bullet_point_id) {
119
- $query = new EntityFieldQuery();
120
- $result = array_pop($query->entityCondition('entity_type', 'node')
121
- ->propertyCondition('type', 'meeting')
122
- ->fieldCondition('field_ref_bullet_points', 'target_id', $bullet_point_id, '=')
123
- ->execute());
124
- $meeting_id = (int) is_array($result) ? array_pop($result)->nid : null;
125
-
126
- $bullet_point = node_load($bullet_point_id);
127
- $subject = 'Dagsorden Punkt: ' . $bullet_point->title;
128
-
129
- $body = "Hej \n\n" . $_POST['name'] . " har sendt dig et dagsordenspunkt. \n\n";
130
-
131
- if (is_numeric($meeting_id)) {
132
- $url = url('node/' . $meeting_id, array('absolute' => TRUE));
133
- $body .= 'Mødet hvor punktet indgår, kan ses på ' . $url . "\n\n";
134
- }
135
-
136
- $body .= "Med beskeden:\n" . trim($_POST['message']) . "\n\n";
137
-
138
- $body .= os2web_print_send_to_friend_print_bullet_point($bullet_point_id);
139
-
140
- $from = variable_get('system_mail');
141
- $message = array(
142
- 'id' => 'send_to_friend_',
143
-
144
- 'subject' => $subject,
145
- 'body' => array($body),
146
- 'headers' => array(
147
- 'From' => $from,
148
- 'Sender' => $from,
149
- 'Return-Path' => $from,
150
- 'Content-Type' => 'text/plain; charset=UTF-8;',
151
- 'Content-Transfer-Encoding' => '8Bit',
152
- ),
153
- );
154
- $system = drupal_mail_system("os2web_print_send_to_friend", "");
155
-
156
- // The format function must be called before calling the mail function.
157
- $message = $system->format($message);
158
-
159
- $system->mail($message);
118
+ function os2web_print_send_to_friend_send_to_friend($bullet_point_id){
119
+ $bullet_point = node_load($bullet_point_id);
120
+ $subject = 'Dagsorden Punkt: ' . $bullet_point->title;
121
+
122
+ $name = check_plain(trim($_POST['name']));
123
+ $message = check_plain(trim($_POST['message']));
124
+ $to_email = check_plain($_POST['email']);
125
+
126
+ $body = "Hej \n\n" . $name ." har sendt dig et dagsordenspunkt. \n\n";
127
+ $body .= "Med beskeden:\n". $message ."\n\n";
128
+
129
+ $body .= os2web_print_send_to_friend_print_bullet_point($bullet_point_id);
130
+
131
+ $from = variable_get('system_mail');
132
+ $message = array(
133
+ 'id' => 'send_to_friend_',
134
+ 'to' => $to_email,
135
+ 'subject' => $subject,
136
+ 'body' => array($body),
137
+ 'headers' => array(
138
+ 'From' => $from,
139
+ 'Sender' => $from,
140
+ 'Return-Path' => $from,
141
+ 'Content-Type' => 'text/plain; charset=UTF-8;',
142
+ 'Content-Transfer-Encoding' => '8Bit',
143
+ ),
144
+ );
145
+ $system = drupal_mail_system("os2web_print_send_to_friend", "");
146
+
147
+ // The format function must be called before calling the mail function.
148
+ $message = $system->format($message);
149
+
150
+
151
+ $system->mail($message);
160
152
}
0 commit comments