commit | author | age
|
4e17e6
|
1 |
<?php |
T |
2 |
|
|
3 |
/* |
|
4 |
+-----------------------------------------------------------------------+ |
|
5 |
| program/steps/mail/compose.inc | |
|
6 |
| | |
|
7 |
| This file is part of the RoundCube Webmail client | |
8fa58e
|
8 |
| Copyright (C) 2005-2008, RoundCube Dev. - Switzerland | |
30233b
|
9 |
| Licensed under the GNU GPL | |
4e17e6
|
10 |
| | |
T |
11 |
| PURPOSE: | |
|
12 |
| Compose a new mail message with all headers and attachments | |
|
13 |
| | |
|
14 |
+-----------------------------------------------------------------------+ |
|
15 |
| Author: Thomas Bruederli <roundcube@gmail.com> | |
|
16 |
+-----------------------------------------------------------------------+ |
|
17 |
|
|
18 |
$Id$ |
|
19 |
|
|
20 |
*/ |
|
21 |
|
8d4bcd
|
22 |
// define constants for message compose mode |
T |
23 |
define('RCUBE_COMPOSE_REPLY', 0x0106); |
|
24 |
define('RCUBE_COMPOSE_FORWARD', 0x0107); |
|
25 |
define('RCUBE_COMPOSE_DRAFT', 0x0108); |
|
26 |
|
4e17e6
|
27 |
|
a894ba
|
28 |
// remove an attachment |
197601
|
29 |
if ($RCMAIL->action=='remove-attachment' && preg_match('/^rcmfile([0-9]+)$/', $_POST['_file'], $regs)) |
4315b0
|
30 |
{ |
aade7b
|
31 |
$id = $regs[1]; |
T |
32 |
if (is_array($_SESSION['compose']['attachments'][$id])) |
4315b0
|
33 |
{ |
aade7b
|
34 |
@unlink($_SESSION['compose']['attachments'][$id]['path']); |
T |
35 |
$_SESSION['compose']['attachments'][$id] = NULL; |
f11541
|
36 |
$OUTPUT->command('remove_from_attachment_list', "rcmfile$id"); |
T |
37 |
$OUTPUT->send(); |
aade7b
|
38 |
exit; |
a894ba
|
39 |
} |
4315b0
|
40 |
} |
aade7b
|
41 |
|
197601
|
42 |
if ($RCMAIL->action=='display-attachment' && preg_match('/^rcmfile([0-9]+)$/', $_GET['_file'], $regs)) |
4315b0
|
43 |
{ |
S |
44 |
$id = $regs[1]; |
|
45 |
if (is_array($_SESSION['compose']['attachments'][$id])) |
|
46 |
{ |
|
47 |
$apath = $_SESSION['compose']['attachments'][$id]['path']; |
|
48 |
header('Content-Type: ' . $_SESSION['compose']['attachments'][$id]['mimetype']); |
|
49 |
header('Content-Length: ' . filesize($apath)); |
|
50 |
readfile($apath); |
|
51 |
} |
|
52 |
exit; |
|
53 |
} |
f0f98f
|
54 |
|
S |
55 |
$MESSAGE_FORM = NULL; |
8d4bcd
|
56 |
$MESSAGE = NULL; |
f0f98f
|
57 |
|
86df15
|
58 |
// Nothing below is called during message composition, only at "new/forward/reply/draft" initialization or |
T |
59 |
// if a compose-ID is given (i.e. when the compose step is opened in a new window/tab). |
|
60 |
// Since there are many ways to leave the compose page improperly, it seems necessary to clean-up an old |
f0f98f
|
61 |
// compose when a "new/forward/reply/draft" is called - otherwise the old session attachments will appear |
S |
62 |
|
86df15
|
63 |
if (!is_array($_SESSION['compose']) || $_SESSION['compose']['id'] != get_input_value('_id', RCUBE_INPUT_GET)) |
4315b0
|
64 |
{ |
86df15
|
65 |
rcmail_compose_cleanup(); |
c719f3
|
66 |
$_SESSION['compose'] = array('id' => uniqid(rand()), 'param' => array_map('strip_tags', $_GET)); |
T |
67 |
|
|
68 |
// redirect to a unique URL with all parameters stored in session |
|
69 |
$OUTPUT->redirect(array('_action' => 'compose', '_id' => $_SESSION['compose']['id'])); |
4315b0
|
70 |
} |
4e17e6
|
71 |
|
10a699
|
72 |
// add some labels to client |
a0109c
|
73 |
rcube_add_label('nosubject', 'norecipientwarning', 'nosubjectwarning', 'nobodywarning', 'notsentwarning', 'savingmessage', 'sendingmessage', 'messagesaved', 'converting'); |
10a699
|
74 |
|
d656f1
|
75 |
// add config parameter to client script |
f11541
|
76 |
$OUTPUT->set_env('draft_autosave', !empty($CONFIG['drafts_mbox']) ? $CONFIG['draft_autosave'] : 0); |
d656f1
|
77 |
|
10a699
|
78 |
|
8d4bcd
|
79 |
// get reference message and set compose mode |
c719f3
|
80 |
if ($msg_uid = $_SESSION['compose']['param']['_reply_uid']) |
8d4bcd
|
81 |
$compose_mode = RCUBE_COMPOSE_REPLY; |
c719f3
|
82 |
else if ($msg_uid = $_SESSION['compose']['param']['_forward_uid']) |
8d4bcd
|
83 |
$compose_mode = RCUBE_COMPOSE_FORWARD; |
c719f3
|
84 |
else if ($msg_uid = $_SESSION['compose']['param']['_draft_uid']) |
8d4bcd
|
85 |
$compose_mode = RCUBE_COMPOSE_DRAFT; |
T |
86 |
|
|
87 |
if (!empty($msg_uid)) |
4315b0
|
88 |
{ |
4e17e6
|
89 |
// similar as in program/steps/mail/show.inc |
8fa58e
|
90 |
$MESSAGE = new rcube_message($msg_uid); |
17b5fb
|
91 |
|
8fa58e
|
92 |
if (!empty($MESSAGE->headers->charset)) |
T |
93 |
$IMAP->set_charset($MESSAGE->headers->charset); |
17b5fb
|
94 |
|
8d4bcd
|
95 |
if ($compose_mode == RCUBE_COMPOSE_REPLY) |
4315b0
|
96 |
{ |
8d4bcd
|
97 |
$_SESSION['compose']['reply_uid'] = $msg_uid; |
8fa58e
|
98 |
$_SESSION['compose']['reply_msgid'] = $MESSAGE->headers->messageID; |
T |
99 |
$_SESSION['compose']['references'] = trim($MESSAGE->headers->references . " " . $MESSAGE->headers->messageID); |
583f1c
|
100 |
|
c719f3
|
101 |
if (!empty($_SESSION['compose']['param']['_all'])) |
8fa58e
|
102 |
$MESSAGE->reply_all = 1; |
4e17e6
|
103 |
} |
4315b0
|
104 |
else if ($compose_mode == RCUBE_COMPOSE_FORWARD) |
S |
105 |
{ |
|
106 |
$_SESSION['compose']['forward_uid'] = $msg_uid; |
|
107 |
} |
|
108 |
} |
4e17e6
|
109 |
|
T |
110 |
/****** compose mode functions ********/ |
|
111 |
|
|
112 |
|
|
113 |
function rcmail_compose_headers($attrib) |
4315b0
|
114 |
{ |
8d4bcd
|
115 |
global $IMAP, $MESSAGE, $DB, $compose_mode; |
583f1c
|
116 |
static $sa_recipients = array(); |
4e17e6
|
117 |
|
T |
118 |
list($form_start, $form_end) = get_form_tags($attrib); |
|
119 |
|
|
120 |
$out = ''; |
|
121 |
$part = strtolower($attrib['part']); |
|
122 |
|
|
123 |
switch ($part) |
4315b0
|
124 |
{ |
4e17e6
|
125 |
case 'from': |
1cded8
|
126 |
return rcmail_compose_header_from($attrib); |
4e17e6
|
127 |
|
T |
128 |
case 'to': |
|
129 |
$fname = '_to'; |
|
130 |
$header = 'to'; |
f11541
|
131 |
|
T |
132 |
// we have a set of recipients stored is session |
c719f3
|
133 |
if (($mailto_id = $_SESSION['compose']['param']['_mailto']) && $_SESSION['mailto'][$mailto_id]) |
fde466
|
134 |
$fvalue = urldecode($_SESSION['mailto'][$mailto_id]); |
c719f3
|
135 |
else if (!empty($_SESSION['compose']['param']['_to'])) |
T |
136 |
$fvalue = $_SESSION['compose']['param']['_to']; |
4e17e6
|
137 |
|
T |
138 |
case 'cc': |
|
139 |
if (!$fname) |
4315b0
|
140 |
{ |
4e17e6
|
141 |
$fname = '_cc'; |
583f1c
|
142 |
$header = 'cc'; |
4315b0
|
143 |
} |
4e17e6
|
144 |
case 'bcc': |
T |
145 |
if (!$fname) |
4315b0
|
146 |
{ |
4e17e6
|
147 |
$fname = '_bcc'; |
462799
|
148 |
$header = 'bcc'; |
4315b0
|
149 |
} |
4e17e6
|
150 |
|
bd4209
|
151 |
$allow_attrib = array('id', 'class', 'style', 'cols', 'rows', 'tabindex'); |
47124c
|
152 |
$field_type = 'html_textarea'; |
4e17e6
|
153 |
break; |
T |
154 |
|
|
155 |
case 'replyto': |
|
156 |
case 'reply-to': |
|
157 |
$fname = '_replyto'; |
317219
|
158 |
$allow_attrib = array('id', 'class', 'style', 'size', 'tabindex'); |
47124c
|
159 |
$field_type = 'html_inputfield'; |
4315b0
|
160 |
break; |
S |
161 |
} |
1966c5
|
162 |
|
597170
|
163 |
if ($fname && !empty($_POST[$fname])) |
01c86f
|
164 |
$fvalue = get_input_value($fname, RCUBE_INPUT_POST, TRUE); |
8d4bcd
|
165 |
|
T |
166 |
else if ($header && $compose_mode == RCUBE_COMPOSE_REPLY) |
4315b0
|
167 |
{ |
4e17e6
|
168 |
// get recipent address(es) out of the message headers |
8fa58e
|
169 |
if ($header=='to' && !empty($MESSAGE->headers->replyto)) |
T |
170 |
$fvalue = $MESSAGE->headers->replyto; |
58e360
|
171 |
|
8fa58e
|
172 |
else if ($header=='to' && !empty($MESSAGE->headers->from)) |
T |
173 |
$fvalue = $MESSAGE->headers->from; |
58e360
|
174 |
|
583f1c
|
175 |
// add recipent of original message if reply to all |
8fa58e
|
176 |
else if ($header=='cc' && !empty($MESSAGE->reply_all)) |
4315b0
|
177 |
{ |
8fa58e
|
178 |
if ($v = $MESSAGE->headers->to) |
8d4bcd
|
179 |
$fvalue .= $v; |
583f1c
|
180 |
|
8fa58e
|
181 |
if ($v = $MESSAGE->headers->cc) |
8d4bcd
|
182 |
$fvalue .= (!empty($fvalue) ? ', ' : '') . $v; |
4315b0
|
183 |
} |
583f1c
|
184 |
|
4e17e6
|
185 |
// split recipients and put them back together in a unique way |
583f1c
|
186 |
if (!empty($fvalue)) |
4315b0
|
187 |
{ |
583f1c
|
188 |
$to_addresses = $IMAP->decode_address_list($fvalue); |
T |
189 |
$fvalue = ''; |
|
190 |
foreach ($to_addresses as $addr_part) |
4315b0
|
191 |
{ |
8fa58e
|
192 |
if (!empty($addr_part['mailto']) && !in_array($addr_part['mailto'], $sa_recipients) && (!$MESSAGE->compose_from || !in_array($addr_part['mailto'], $MESSAGE->compose_from))) |
4315b0
|
193 |
{ |
583f1c
|
194 |
$fvalue .= (strlen($fvalue) ? ', ':'').$addr_part['string']; |
T |
195 |
$sa_recipients[] = $addr_part['mailto']; |
|
196 |
} |
|
197 |
} |
4e17e6
|
198 |
} |
4315b0
|
199 |
} |
8d4bcd
|
200 |
else if ($header && $compose_mode == RCUBE_COMPOSE_DRAFT) |
4315b0
|
201 |
{ |
1966c5
|
202 |
// get drafted headers |
8fa58e
|
203 |
if ($header=='to' && !empty($MESSAGE->headers->to)) |
T |
204 |
$fvalue = $MESSAGE->get_header('to'); |
1966c5
|
205 |
|
8fa58e
|
206 |
if ($header=='cc' && !empty($MESSAGE->headers->cc)) |
T |
207 |
$fvalue = $MESSAGE->get_header('cc'); |
1966c5
|
208 |
|
8fa58e
|
209 |
if ($header=='bcc' && !empty($MESSAGE->headers->bcc)) |
T |
210 |
$fvalue = $MESSAGE->get_header('bcc'); |
4315b0
|
211 |
} |
583f1c
|
212 |
|
4e17e6
|
213 |
|
T |
214 |
if ($fname && $field_type) |
4315b0
|
215 |
{ |
4e17e6
|
216 |
// pass the following attributes to the form class |
T |
217 |
$field_attrib = array('name' => $fname); |
|
218 |
foreach ($attrib as $attr => $value) |
|
219 |
if (in_array($attr, $allow_attrib)) |
|
220 |
$field_attrib[$attr] = $value; |
|
221 |
|
|
222 |
// create teaxtarea object |
|
223 |
$input = new $field_type($field_attrib); |
47124c
|
224 |
$out = $input->show($fvalue); |
4315b0
|
225 |
} |
4e17e6
|
226 |
|
T |
227 |
if ($form_start) |
|
228 |
$out = $form_start.$out; |
1966c5
|
229 |
|
4e17e6
|
230 |
return $out; |
4315b0
|
231 |
} |
4e17e6
|
232 |
|
T |
233 |
|
1cded8
|
234 |
|
T |
235 |
function rcmail_compose_header_from($attrib) |
4315b0
|
236 |
{ |
8fa58e
|
237 |
global $IMAP, $MESSAGE, $DB, $USER, $OUTPUT, $compose_mode; |
1cded8
|
238 |
|
T |
239 |
// pass the following attributes to the form class |
|
240 |
$field_attrib = array('name' => '_from'); |
|
241 |
foreach ($attrib as $attr => $value) |
|
242 |
if (in_array($attr, array('id', 'class', 'style', 'size', 'tabindex'))) |
|
243 |
$field_attrib[$attr] = $value; |
4e17e6
|
244 |
|
1cded8
|
245 |
// extract all recipients of the reply-message |
T |
246 |
$a_recipients = array(); |
8fa58e
|
247 |
if ($compose_mode == RCUBE_COMPOSE_REPLY && is_object($MESSAGE->headers)) |
4315b0
|
248 |
{ |
8fa58e
|
249 |
$MESSAGE->compose_from = array(); |
58e360
|
250 |
|
8fa58e
|
251 |
$a_to = $IMAP->decode_address_list($MESSAGE->headers->to); |
1cded8
|
252 |
foreach ($a_to as $addr) |
4315b0
|
253 |
{ |
1cded8
|
254 |
if (!empty($addr['mailto'])) |
T |
255 |
$a_recipients[] = $addr['mailto']; |
4315b0
|
256 |
} |
4e17e6
|
257 |
|
8fa58e
|
258 |
if (!empty($MESSAGE->headers->cc)) |
4315b0
|
259 |
{ |
8fa58e
|
260 |
$a_cc = $IMAP->decode_address_list($MESSAGE->headers->cc); |
1cded8
|
261 |
foreach ($a_cc as $addr) |
4315b0
|
262 |
{ |
1cded8
|
263 |
if (!empty($addr['mailto'])) |
T |
264 |
$a_recipients[] = $addr['mailto']; |
|
265 |
} |
|
266 |
} |
4315b0
|
267 |
} |
4e17e6
|
268 |
|
1cded8
|
269 |
// get this user's identities |
fba1f5
|
270 |
$sql_result = $USER->list_identities(); |
a0109c
|
271 |
|
1cded8
|
272 |
if ($DB->num_rows($sql_result)) |
4315b0
|
273 |
{ |
1cded8
|
274 |
$from_id = 0; |
T |
275 |
$a_signatures = array(); |
a0109c
|
276 |
|
f11541
|
277 |
$field_attrib['onchange'] = JS_OBJECT_NAME.".change_identity(this)"; |
47124c
|
278 |
$select_from = new html_select($field_attrib); |
a0109c
|
279 |
|
1cded8
|
280 |
while ($sql_arr = $DB->fetch_assoc($sql_result)) |
4315b0
|
281 |
{ |
a0109c
|
282 |
$identity_id = $sql_arr['identity_id']; |
S |
283 |
$select_from->add(format_email_recipient($sql_arr['email'], $sql_arr['name']), $identity_id); |
4e17e6
|
284 |
|
1cded8
|
285 |
// add signature to array |
T |
286 |
if (!empty($sql_arr['signature'])) |
4315b0
|
287 |
{ |
a0109c
|
288 |
$a_signatures[$identity_id]['text'] = $sql_arr['signature']; |
S |
289 |
$a_signatures[$identity_id]['is_html'] = ($sql_arr['html_signature'] == 1) ? true : false; |
dd792e
|
290 |
if ($a_signatures[$identity_id]['is_html']) |
4315b0
|
291 |
{ |
dd792e
|
292 |
$h2t = new html2text($a_signatures[$identity_id]['text'], false, false); |
S |
293 |
$plainTextPart = $h2t->get_text(); |
e7d37a
|
294 |
$a_signatures[$identity_id]['plain_text'] = trim(html_entity_decode($plainTextPart, ENT_NOQUOTES, 'UTF-8')); |
a0109c
|
295 |
} |
4315b0
|
296 |
} |
a0109c
|
297 |
|
1cded8
|
298 |
// set identity if it's one of the reply-message recipients |
T |
299 |
if (in_array($sql_arr['email'], $a_recipients)) |
|
300 |
$from_id = $sql_arr['identity_id']; |
a0109c
|
301 |
|
8fa58e
|
302 |
if ($compose_mode == RCUBE_COMPOSE_REPLY && is_array($MESSAGE->compose_from)) |
T |
303 |
$MESSAGE->compose_from[] = $sql_arr['email']; |
1966c5
|
304 |
|
8fa58e
|
305 |
if ($compose_mode == RCUBE_COMPOSE_DRAFT && strstr($MESSAGE->headers->from, $sql_arr['email'])) |
1966c5
|
306 |
$from_id = $sql_arr['identity_id']; |
4315b0
|
307 |
} |
4e17e6
|
308 |
|
1cded8
|
309 |
// overwrite identity selection with post parameter |
T |
310 |
if (isset($_POST['_from'])) |
8d4bcd
|
311 |
$from_id = get_input_value('_from', RCUBE_INPUT_POST); |
4e17e6
|
312 |
|
1cded8
|
313 |
$out = $select_from->show($from_id); |
4e17e6
|
314 |
|
1cded8
|
315 |
// add signatures to client |
f11541
|
316 |
$OUTPUT->set_env('signatures', $a_signatures); |
4315b0
|
317 |
} |
1cded8
|
318 |
else |
4315b0
|
319 |
{ |
47124c
|
320 |
$input_from = new html_inputfield($field_attrib); |
1cded8
|
321 |
$out = $input_from->show($_POST['_from']); |
4315b0
|
322 |
} |
1966c5
|
323 |
|
1cded8
|
324 |
if ($form_start) |
T |
325 |
$out = $form_start.$out; |
4e17e6
|
326 |
|
1cded8
|
327 |
return $out; |
4315b0
|
328 |
} |
4e17e6
|
329 |
|
T |
330 |
|
|
331 |
function rcmail_compose_body($attrib) |
4315b0
|
332 |
{ |
197601
|
333 |
global $RCMAIL, $CONFIG, $OUTPUT, $MESSAGE, $compose_mode; |
4e17e6
|
334 |
|
T |
335 |
list($form_start, $form_end) = get_form_tags($attrib); |
|
336 |
unset($attrib['form']); |
dd53e2
|
337 |
|
T |
338 |
if (empty($attrib['id'])) |
|
339 |
$attrib['id'] = 'rcmComposeMessage'; |
a0109c
|
340 |
|
4e17e6
|
341 |
$attrib['name'] = '_message'; |
a0109c
|
342 |
|
S |
343 |
if ($CONFIG['htmleditor']) |
|
344 |
$isHtml = true; |
|
345 |
else |
|
346 |
$isHtml = false; |
4e17e6
|
347 |
|
T |
348 |
$body = ''; |
a0109c
|
349 |
|
4e17e6
|
350 |
// use posted message body |
597170
|
351 |
if (!empty($_POST['_message'])) |
8fa58e
|
352 |
{ |
T |
353 |
$body = get_input_value('_message', RCUBE_INPUT_POST, true); |
|
354 |
} |
|
355 |
else if ($compose_mode) |
|
356 |
{ |
|
357 |
if ($isHtml && $MESSAGE->has_html_part()) |
a0109c
|
358 |
{ |
8fa58e
|
359 |
$body = $MESSAGE->first_html_part(); |
a0109c
|
360 |
$isHtml = true; |
4e17e6
|
361 |
} |
8fa58e
|
362 |
else |
4e17e6
|
363 |
{ |
8fa58e
|
364 |
$body = $MESSAGE->first_text_part(); |
a0109c
|
365 |
$isHtml = false; |
4e17e6
|
366 |
} |
8fa58e
|
367 |
|
T |
368 |
// compose reply-body |
|
369 |
if ($compose_mode == RCUBE_COMPOSE_REPLY) |
|
370 |
$body = rcmail_create_reply_body($body, $isHtml); |
|
371 |
// forward message body inline |
|
372 |
else if ($compose_mode == RCUBE_COMPOSE_FORWARD) |
|
373 |
$body = rcmail_create_forward_body($body, $isHtml); |
|
374 |
// load draft message body |
|
375 |
else if ($compose_mode == RCUBE_COMPOSE_DRAFT) |
|
376 |
$body = rcmail_create_draft_body($body, $isHtml); |
|
377 |
} |
a0109c
|
378 |
|
197601
|
379 |
$tinylang = substr($_SESSION['language'], 0, 2); |
8e5def
|
380 |
if (!file_exists('program/js/tiny_mce/langs/'.$tinylang.'.js')) |
S |
381 |
$tinylang = 'en'; |
|
382 |
|
a0109c
|
383 |
$OUTPUT->include_script('tiny_mce/tiny_mce.js'); |
S |
384 |
$OUTPUT->include_script("editor.js"); |
8e5def
|
385 |
$OUTPUT->add_script('rcmail_editor_init("$__skin_path", "'.$tinylang.'");'); |
a0109c
|
386 |
|
4e17e6
|
387 |
$out = $form_start ? "$form_start\n" : ''; |
1966c5
|
388 |
|
8fa58e
|
389 |
$saveid = new html_hiddenfield(array('name' => '_draft_saveid', 'value' => $compose_mode==RCUBE_COMPOSE_DRAFT ? str_replace(array('<','>'), "", $MESSAGE->headers->messageID) : '')); |
f0f98f
|
390 |
$out .= $saveid->show(); |
1966c5
|
391 |
|
47124c
|
392 |
$drafttoggle = new html_hiddenfield(array('name' => '_draft', 'value' => 'yes')); |
1966c5
|
393 |
$out .= $drafttoggle->show(); |
S |
394 |
|
47124c
|
395 |
$msgtype = new html_hiddenfield(array('name' => '_is_html', 'value' => ($isHtml?"1":"0"))); |
a0109c
|
396 |
$out .= $msgtype->show(); |
S |
397 |
|
|
398 |
// If desired, set this text area to be editable by TinyMCE |
d9344f
|
399 |
if ($isHtml) $attrib['class'] = "mce_editor"; |
47124c
|
400 |
$textarea = new html_textarea($attrib); |
4e17e6
|
401 |
$out .= $textarea->show($body); |
T |
402 |
$out .= $form_end ? "\n$form_end" : ''; |
a0109c
|
403 |
|
dd53e2
|
404 |
// include GoogieSpell |
a0109c
|
405 |
if (!empty($CONFIG['enable_spellcheck']) && !$isHtml) |
ed5d29
|
406 |
{ |
996066
|
407 |
$lang_set = ''; |
T |
408 |
if (!empty($CONFIG['spellcheck_languages']) && is_array($CONFIG['spellcheck_languages'])) |
|
409 |
$lang_set = "googie.setLanguages(".array2js($CONFIG['spellcheck_languages']).");\n"; |
|
410 |
|
ed5d29
|
411 |
$OUTPUT->include_script('googiespell.js'); |
2bca6e
|
412 |
$OUTPUT->add_script(sprintf( |
T |
413 |
"var googie = new GoogieSpell('\$__skin_path/images/googiespell/','%s&_action=spell&lang=');\n". |
|
414 |
"googie.lang_chck_spell = \"%s\";\n". |
|
415 |
"googie.lang_rsm_edt = \"%s\";\n". |
|
416 |
"googie.lang_close = \"%s\";\n". |
|
417 |
"googie.lang_revert = \"%s\";\n". |
|
418 |
"googie.lang_no_error_found = \"%s\";\n%s". |
|
419 |
"googie.setCurrentLanguage('%s');\n". |
|
420 |
"googie.decorateTextarea('%s');\n". |
|
421 |
"%s.set_env('spellcheck', googie);", |
197601
|
422 |
$RCMAIL->comm_path, |
2bca6e
|
423 |
JQ(Q(rcube_label('checkspelling'))), |
T |
424 |
JQ(Q(rcube_label('resumeediting'))), |
|
425 |
JQ(Q(rcube_label('close'))), |
|
426 |
JQ(Q(rcube_label('revertto'))), |
|
427 |
JQ(Q(rcube_label('nospellerrors'))), |
|
428 |
$lang_set, |
197601
|
429 |
substr($_SESSION['language'], 0, 2), |
2bca6e
|
430 |
$attrib['id'], |
f11541
|
431 |
JS_OBJECT_NAME), 'foot'); |
ed5d29
|
432 |
|
T |
433 |
rcube_add_label('checking'); |
|
434 |
} |
f0f98f
|
435 |
|
027af3
|
436 |
$out .= "\n".'<iframe name="savetarget" src="program/blank.gif" style="width:0;height:0;border:none;visibility:hidden;"></iframe>'; |
41fa0b
|
437 |
|
4e17e6
|
438 |
return $out; |
4315b0
|
439 |
} |
4e17e6
|
440 |
|
T |
441 |
|
a0109c
|
442 |
function rcmail_create_reply_body($body, $bodyIsHtml) |
4315b0
|
443 |
{ |
8d4bcd
|
444 |
global $IMAP, $MESSAGE; |
4e17e6
|
445 |
|
a0109c
|
446 |
if (! $bodyIsHtml) |
S |
447 |
{ |
|
448 |
// soft-wrap message first |
|
449 |
$body = wordwrap($body, 75); |
4e17e6
|
450 |
|
a0109c
|
451 |
// split body into single lines |
S |
452 |
$a_lines = preg_split('/\r?\n/', $body); |
4e17e6
|
453 |
|
a0109c
|
454 |
// add > to each line |
S |
455 |
for($n=0; $n<sizeof($a_lines); $n++) |
4315b0
|
456 |
{ |
a0109c
|
457 |
if (strpos($a_lines[$n], '>')===0) |
S |
458 |
$a_lines[$n] = '>'.$a_lines[$n]; |
|
459 |
else |
|
460 |
$a_lines[$n] = '> '.$a_lines[$n]; |
4315b0
|
461 |
} |
4e17e6
|
462 |
|
a0109c
|
463 |
$body = join("\n", $a_lines); |
4e17e6
|
464 |
|
a0109c
|
465 |
// add title line |
S |
466 |
$prefix = sprintf("\n\n\nOn %s, %s wrote:\n", |
8fa58e
|
467 |
$MESSAGE->headers->date, |
T |
468 |
$MESSAGE->get_header('from')); |
1cded8
|
469 |
|
a0109c
|
470 |
// try to remove the signature |
a63e10
|
471 |
if ($sp = strrpos($body, '-- ')) |
a0109c
|
472 |
{ |
S |
473 |
if ($body{$sp+3}==' ' || $body{$sp+3}=="\n" || $body{$sp+3}=="\r") |
|
474 |
$body = substr($body, 0, $sp-1); |
|
475 |
} |
|
476 |
$suffix = ''; |
|
477 |
} |
|
478 |
else |
|
479 |
{ |
8fa58e
|
480 |
$prefix = sprintf("<br /><br />On %s, %s wrote:<br />\n", |
T |
481 |
$MESSAGE->headers->date, |
|
482 |
Q($MESSAGE->get_header('from'))); |
|
483 |
$prefix .= '<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px; width:100%">'; |
4315b0
|
484 |
$suffix = "</blockquote>"; |
a0109c
|
485 |
} |
S |
486 |
|
|
487 |
return $prefix.$body.$suffix; |
4315b0
|
488 |
} |
4e17e6
|
489 |
|
T |
490 |
|
a0109c
|
491 |
function rcmail_create_forward_body($body, $bodyIsHtml) |
4315b0
|
492 |
{ |
8d4bcd
|
493 |
global $IMAP, $MESSAGE; |
4e17e6
|
494 |
|
8fa58e
|
495 |
if (!$bodyIsHtml) |
a0109c
|
496 |
{ |
S |
497 |
// soft-wrap message first |
|
498 |
$body = wordwrap($body, 80); |
4e17e6
|
499 |
|
a0109c
|
500 |
$prefix = sprintf("\n\n\n-------- Original Message --------\nSubject: %s\nDate: %s\nFrom: %s\nTo: %s\n\n", |
8fa58e
|
501 |
$MESSAGE->subject, |
T |
502 |
$MESSAGE->headers->date, |
|
503 |
$MESSAGE->get_header('from'), |
|
504 |
$MESSAGE->get_header('to')); |
a0109c
|
505 |
} |
S |
506 |
else |
|
507 |
{ |
4315b0
|
508 |
$prefix = sprintf( |
8fa58e
|
509 |
"<br><br>-------- Original Message --------" . |
a0109c
|
510 |
"<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tbody>" . |
S |
511 |
"<tr><th align=\"right\" nowrap=\"nowrap\" valign=\"baseline\">Subject: </th><td>%s</td></tr>" . |
|
512 |
"<tr><th align=\"right\" nowrap=\"nowrap\" valign=\"baseline\">Date: </th><td>%s</td></tr>" . |
|
513 |
"<tr><th align=\"right\" nowrap=\"nowrap\" valign=\"baseline\">From: </th><td>%s</td></tr>" . |
|
514 |
"<tr><th align=\"right\" nowrap=\"nowrap\" valign=\"baseline\">To: </th><td>%s</td></tr>" . |
|
515 |
"</tbody></table><br>", |
8fa58e
|
516 |
Q($MESSAGE->subject), |
T |
517 |
Q($MESSAGE->headers->date), |
|
518 |
Q($MESSAGE->get_header('from')), |
|
519 |
Q($MESSAGE->get_header('to'))); |
a0109c
|
520 |
} |
S |
521 |
|
597170
|
522 |
// add attachments |
8fa58e
|
523 |
if (!isset($_SESSION['compose']['forward_attachments']) && is_array($MESSAGE->mime_parts)) |
1bc48e
|
524 |
rcmail_write_compose_attachments($MESSAGE, $bodyIsHtml); |
5cc4b1
|
525 |
|
4e17e6
|
526 |
return $prefix.$body; |
4315b0
|
527 |
} |
4e17e6
|
528 |
|
8d4bcd
|
529 |
|
a0109c
|
530 |
function rcmail_create_draft_body($body, $bodyIsHtml) |
4315b0
|
531 |
{ |
8fa58e
|
532 |
global $MESSAGE; |
8ecb0e
|
533 |
|
T |
534 |
/** |
|
535 |
* add attachments |
8fa58e
|
536 |
* sizeof($MESSAGE->mime_parts can be 1 - e.g. attachment, but no text! |
8ecb0e
|
537 |
*/ |
T |
538 |
if (!isset($_SESSION['compose']['forward_attachments']) |
8fa58e
|
539 |
&& is_array($MESSAGE->mime_parts) |
T |
540 |
&& count($MESSAGE->mime_parts) > 0) |
1bc48e
|
541 |
rcmail_write_compose_attachments($MESSAGE, $bodyIsHtml); |
1966c5
|
542 |
|
S |
543 |
return $body; |
4315b0
|
544 |
} |
8d4bcd
|
545 |
|
T |
546 |
|
1bc48e
|
547 |
function rcmail_write_compose_attachments(&$message, $bodyIsHtml) |
4315b0
|
548 |
{ |
8fa58e
|
549 |
global $RCMAIL, $IMAP; |
70d4b9
|
550 |
|
8fa58e
|
551 |
$temp_dir = unslashify($RCMAIL->config->get('temp_dir')); |
8d4bcd
|
552 |
|
T |
553 |
if (!is_array($_SESSION['compose']['attachments'])) |
|
554 |
$_SESSION['compose']['attachments'] = array(); |
|
555 |
|
8fa58e
|
556 |
foreach ((array)$message->mime_parts as $pid => $part) |
4315b0
|
557 |
{ |
1bc48e
|
558 |
if (($part->ctype_primary != 'message' || !$bodyIsHtml) && |
8d4bcd
|
559 |
($part->disposition=='attachment' || $part->disposition=='inline' || $part->headers['content-id'] || |
5cc4b1
|
560 |
(empty($part->disposition) && $part->filename))) |
4315b0
|
561 |
{ |
8d4bcd
|
562 |
$tmp_path = tempnam($temp_dir, 'rcmAttmnt'); |
T |
563 |
if ($fp = fopen($tmp_path, 'w')) |
4315b0
|
564 |
{ |
8fa58e
|
565 |
fwrite($fp, $message->get_part_content($pid)); |
8d4bcd
|
566 |
fclose($fp); |
T |
567 |
|
|
568 |
$_SESSION['compose']['attachments'][] = array( |
|
569 |
'mimetype' => $part->ctype_primary . '/' . $part->ctype_secondary, |
5cc4b1
|
570 |
'name' => $part->filename, |
8d4bcd
|
571 |
'path' => $tmp_path |
T |
572 |
); |
|
573 |
} |
|
574 |
} |
4315b0
|
575 |
} |
8d4bcd
|
576 |
|
8fa58e
|
577 |
$_SESSION['compose']['forward_attachments'] = true; |
4315b0
|
578 |
} |
4e17e6
|
579 |
|
T |
580 |
|
|
581 |
function rcmail_compose_subject($attrib) |
4315b0
|
582 |
{ |
8fa58e
|
583 |
global $MESSAGE, $compose_mode; |
4e17e6
|
584 |
|
T |
585 |
list($form_start, $form_end) = get_form_tags($attrib); |
|
586 |
unset($attrib['form']); |
|
587 |
|
|
588 |
$attrib['name'] = '_subject'; |
47124c
|
589 |
$textfield = new html_inputfield($attrib); |
4e17e6
|
590 |
|
T |
591 |
$subject = ''; |
|
592 |
|
|
593 |
// use subject from post |
597170
|
594 |
if (isset($_POST['_subject'])) |
01c86f
|
595 |
$subject = get_input_value('_subject', RCUBE_INPUT_POST, TRUE); |
4e17e6
|
596 |
|
T |
597 |
// create a reply-subject |
8d4bcd
|
598 |
else if ($compose_mode == RCUBE_COMPOSE_REPLY) |
4315b0
|
599 |
{ |
8fa58e
|
600 |
if (eregi('^re:', $MESSAGE->subject)) |
T |
601 |
$subject = $MESSAGE->subject; |
520c36
|
602 |
else |
8fa58e
|
603 |
$subject = 'Re: '.$MESSAGE->subject; |
4315b0
|
604 |
} |
4e17e6
|
605 |
|
T |
606 |
// create a forward-subject |
8d4bcd
|
607 |
else if ($compose_mode == RCUBE_COMPOSE_FORWARD) |
4315b0
|
608 |
{ |
8fa58e
|
609 |
if (eregi('^fwd:', $MESSAGE->subject)) |
T |
610 |
$subject = $MESSAGE->subject; |
09941e
|
611 |
else |
8fa58e
|
612 |
$subject = 'Fwd: '.$MESSAGE->subject; |
4315b0
|
613 |
} |
4e17e6
|
614 |
|
1966c5
|
615 |
// creeate a draft-subject |
8d4bcd
|
616 |
else if ($compose_mode == RCUBE_COMPOSE_DRAFT) |
8fa58e
|
617 |
$subject = $MESSAGE->subject; |
4e17e6
|
618 |
|
T |
619 |
$out = $form_start ? "$form_start\n" : ''; |
|
620 |
$out .= $textfield->show($subject); |
|
621 |
$out .= $form_end ? "\n$form_end" : ''; |
|
622 |
|
|
623 |
return $out; |
4315b0
|
624 |
} |
4e17e6
|
625 |
|
T |
626 |
|
|
627 |
function rcmail_compose_attachment_list($attrib) |
4315b0
|
628 |
{ |
f11541
|
629 |
global $OUTPUT, $CONFIG; |
4e17e6
|
630 |
|
T |
631 |
// add ID if not given |
|
632 |
if (!$attrib['id']) |
|
633 |
$attrib['id'] = 'rcmAttachmentList'; |
|
634 |
|
8fa58e
|
635 |
$out = "\n"; |
4e17e6
|
636 |
|
T |
637 |
if (is_array($_SESSION['compose']['attachments'])) |
4315b0
|
638 |
{ |
a894ba
|
639 |
if ($attrib['deleteicon']) |
8fa58e
|
640 |
$button = html::img(array( |
T |
641 |
'src' => $CONFIG['skin_path'] . $attrib['deleteicon'], |
|
642 |
'alt' => rcube_label('delete'), |
|
643 |
'style' => "border:0;padding-right:2px;vertical-align:middle")); |
a894ba
|
644 |
else |
8fa58e
|
645 |
$button = Q(rcube_label('delete')); |
a894ba
|
646 |
|
aade7b
|
647 |
foreach ($_SESSION['compose']['attachments'] as $id => $a_prop) |
6d5dba
|
648 |
{ |
T |
649 |
if (empty($a_prop)) |
|
650 |
continue; |
|
651 |
|
8fa58e
|
652 |
$out .= html::tag('li', array('id' => "rcmfile".$id), |
T |
653 |
html::a(array( |
|
654 |
'href' => "#delete", |
|
655 |
'title' => rcube_label('delete'), |
59200c
|
656 |
'onclick' => sprintf("return %s.command('remove-attachment','rcmfile%d', this)", JS_OBJECT_NAME, $id)), |
8fa58e
|
657 |
$button) . Q($a_prop['name'])); |
6d5dba
|
658 |
} |
4315b0
|
659 |
} |
4e17e6
|
660 |
|
f11541
|
661 |
$OUTPUT->add_gui_object('attachmentlist', $attrib['id']); |
4e17e6
|
662 |
|
8fa58e
|
663 |
return html::tag('ul', $attrib, $out, html::$common_attrib); |
4315b0
|
664 |
} |
4e17e6
|
665 |
|
T |
666 |
|
|
667 |
function rcmail_compose_attachment_form($attrib) |
4315b0
|
668 |
{ |
197601
|
669 |
global $OUTPUT; |
4e17e6
|
670 |
|
T |
671 |
// add ID if not given |
|
672 |
if (!$attrib['id']) |
|
673 |
$attrib['id'] = 'rcmUploadbox'; |
|
674 |
|
885ebb
|
675 |
$button = new html_inputfield(array('type' => 'button', 'class' => 'button')); |
4e17e6
|
676 |
|
197601
|
677 |
$out = html::div($attrib, |
885ebb
|
678 |
$OUTPUT->form_tag(array('name' => 'form', 'method' => 'post', 'enctype' => 'multipart/form-data')) . |
197601
|
679 |
rcmail_compose_attachment_field(array()) . html::br() . |
T |
680 |
$button->show(rcube_label('close'), array('onclick' => "document.getElementById('$attrib[id]').style.visibility='hidden'")) . |
|
681 |
$button->show(rcube_label('upload'), array('onclick' => JS_OBJECT_NAME . ".command('send-attachment', this.form)")) |
|
682 |
); |
|
683 |
|
4e17e6
|
684 |
|
f11541
|
685 |
$OUTPUT->add_gui_object('uploadbox', $attrib['id']); |
4e17e6
|
686 |
return $out; |
4315b0
|
687 |
} |
4e17e6
|
688 |
|
T |
689 |
|
|
690 |
function rcmail_compose_attachment_field($attrib) |
4315b0
|
691 |
{ |
4e17e6
|
692 |
// allow the following attributes to be added to the <input> tag |
T |
693 |
$attrib_str = create_attrib_string($attrib, array('id', 'class', 'style', 'size')); |
|
694 |
|
|
695 |
$out = '<input type="file" name="_attachments[]"'. $attrib_str . " />"; |
|
696 |
return $out; |
4315b0
|
697 |
} |
4e17e6
|
698 |
|
66e2bf
|
699 |
|
4e17e6
|
700 |
function rcmail_priority_selector($attrib) |
4315b0
|
701 |
{ |
ff08ee
|
702 |
global $MESSAGE; |
T |
703 |
|
4e17e6
|
704 |
list($form_start, $form_end) = get_form_tags($attrib); |
T |
705 |
unset($attrib['form']); |
|
706 |
|
|
707 |
$attrib['name'] = '_priority'; |
47124c
|
708 |
$selector = new html_select($attrib); |
4e17e6
|
709 |
|
T |
710 |
$selector->add(array(rcube_label('lowest'), |
|
711 |
rcube_label('low'), |
|
712 |
rcube_label('normal'), |
|
713 |
rcube_label('high'), |
|
714 |
rcube_label('highest')), |
7902df
|
715 |
array(5, 4, 0, 2, 1)); |
4e17e6
|
716 |
|
8fa58e
|
717 |
$sel = isset($_POST['_priority']) ? $_POST['_priority'] : intval($MESSAGE->headers->priority); |
4e17e6
|
718 |
|
T |
719 |
$out = $form_start ? "$form_start\n" : ''; |
|
720 |
$out .= $selector->show($sel); |
|
721 |
$out .= $form_end ? "\n$form_end" : ''; |
|
722 |
|
|
723 |
return $out; |
4315b0
|
724 |
} |
4e17e6
|
725 |
|
T |
726 |
|
620439
|
727 |
function rcmail_receipt_checkbox($attrib) |
4315b0
|
728 |
{ |
e47aad
|
729 |
global $MESSAGE, $compose_mode; |
ff08ee
|
730 |
|
620439
|
731 |
list($form_start, $form_end) = get_form_tags($attrib); |
T |
732 |
unset($attrib['form']); |
66e2bf
|
733 |
|
T |
734 |
if (!isset($attrib['id'])) |
|
735 |
$attrib['id'] = 'receipt'; |
620439
|
736 |
|
T |
737 |
$attrib['name'] = '_receipt'; |
66e2bf
|
738 |
$attrib['value'] = '1'; |
47124c
|
739 |
$checkbox = new html_checkbox($attrib); |
620439
|
740 |
|
T |
741 |
$out = $form_start ? "$form_start\n" : ''; |
e47aad
|
742 |
$out .= $checkbox->show( |
A |
743 |
$compose_mode == RCUBE_COMPOSE_DRAFT && $MESSAGE->headers->mdn_to ? 1 : 0); |
620439
|
744 |
$out .= $form_end ? "\n$form_end" : ''; |
T |
745 |
|
|
746 |
return $out; |
4315b0
|
747 |
} |
620439
|
748 |
|
T |
749 |
|
a0109c
|
750 |
function rcmail_editor_selector($attrib) |
S |
751 |
{ |
|
752 |
global $CONFIG, $MESSAGE, $compose_mode; |
|
753 |
|
|
754 |
$choices = array( |
6b1fc0
|
755 |
'html' => 'htmltoggle', |
S |
756 |
'plain' => 'plaintoggle' |
a0109c
|
757 |
); |
S |
758 |
|
8fa58e
|
759 |
// determine whether HTML or plain text should be checked |
T |
760 |
$useHtml = $CONFIG['htmleditor'] ? true : false; |
a0109c
|
761 |
|
8fa58e
|
762 |
if ($compose_mode) |
T |
763 |
$useHtml = ($useHtml && $MESSAGE->has_html_part()); |
d9344f
|
764 |
|
a0109c
|
765 |
$selector = ''; |
8fa58e
|
766 |
$chosenvalue = $useHtml ? 'html' : 'plain'; |
T |
767 |
$radio = new html_radiobutton(array('name' => '_editorSelect', 'onclick' => 'return rcmail_toggle_editor(this)')); |
a0109c
|
768 |
foreach ($choices as $value => $text) |
4315b0
|
769 |
{ |
6b1fc0
|
770 |
$attrib['id'] = '_' . $value; |
d9344f
|
771 |
$attrib['value'] = $value; |
8fa58e
|
772 |
$selector .= $radio->show($chosenvalue, $attrib) . html::label($attrib['id'], Q(rcube_label($text))); |
4315b0
|
773 |
} |
a0109c
|
774 |
|
S |
775 |
return $selector; |
|
776 |
} |
|
777 |
|
|
778 |
|
4e17e6
|
779 |
function get_form_tags($attrib) |
4315b0
|
780 |
{ |
197601
|
781 |
global $RCMAIL, $MESSAGE_FORM; |
4e17e6
|
782 |
|
T |
783 |
$form_start = ''; |
|
784 |
if (!strlen($MESSAGE_FORM)) |
4315b0
|
785 |
{ |
197601
|
786 |
$hiddenfields = new html_hiddenfield(array('name' => '_task', 'value' => $RCMAIL->task)); |
4e17e6
|
787 |
$hiddenfields->add(array('name' => '_action', 'value' => 'send')); |
1966c5
|
788 |
|
197601
|
789 |
$form_start = empty($attrib['form']) ? $RCMAIL->output->form_tag(array('name' => "form", 'method' => "post")) : ''; |
4e17e6
|
790 |
$form_start .= $hiddenfields->show(); |
4315b0
|
791 |
} |
4e17e6
|
792 |
|
T |
793 |
$form_end = (strlen($MESSAGE_FORM) && !strlen($attrib['form'])) ? '</form>' : ''; |
597170
|
794 |
$form_name = !empty($attrib['form']) ? $attrib['form'] : 'form'; |
4e17e6
|
795 |
|
T |
796 |
if (!strlen($MESSAGE_FORM)) |
197601
|
797 |
$RCMAIL->output->add_gui_object('messageform', $form_name); |
4e17e6
|
798 |
|
T |
799 |
$MESSAGE_FORM = $form_name; |
|
800 |
|
47124c
|
801 |
return array($form_start, $form_end); |
4315b0
|
802 |
} |
4e17e6
|
803 |
|
T |
804 |
|
f11541
|
805 |
// register UI objects |
T |
806 |
$OUTPUT->add_handlers(array( |
|
807 |
'composeheaders' => 'rcmail_compose_headers', |
|
808 |
'composesubject' => 'rcmail_compose_subject', |
|
809 |
'composebody' => 'rcmail_compose_body', |
|
810 |
'composeattachmentlist' => 'rcmail_compose_attachment_list', |
|
811 |
'composeattachmentform' => 'rcmail_compose_attachment_form', |
|
812 |
'composeattachment' => 'rcmail_compose_attachment_field', |
|
813 |
'priorityselector' => 'rcmail_priority_selector', |
|
814 |
'editorselector' => 'rcmail_editor_selector', |
|
815 |
'receiptcheckbox' => 'rcmail_receipt_checkbox', |
|
816 |
)); |
fd8c50
|
817 |
|
4e17e6
|
818 |
/****** get contacts for this user and add them to client scripts ********/ |
f11541
|
819 |
|
fba1f5
|
820 |
$CONTACTS = new rcube_contacts($DB, $USER->ID); |
f11541
|
821 |
$CONTACTS->set_pagesize(1000); |
c658ed
|
822 |
|
T |
823 |
$a_contacts = array(); |
4e17e6
|
824 |
|
f11541
|
825 |
if ($result = $CONTACTS->list_records()) |
148e7b
|
826 |
{ |
f11541
|
827 |
while ($sql_arr = $result->iterate()) |
4e17e6
|
828 |
if ($sql_arr['email']) |
0c6f4b
|
829 |
$a_contacts[] = format_email_recipient($sql_arr['email'], $sql_arr['name']); |
148e7b
|
830 |
} |
b67bcc
|
831 |
if (!empty($CONFIG['ldap_public']) && is_array($CONFIG['ldap_public'])) |
148e7b
|
832 |
{ |
d75921
|
833 |
/* LDAP autocompletion */ |
T |
834 |
foreach ($CONFIG['ldap_public'] as $ldapserv_config) |
c658ed
|
835 |
{ |
a0530a
|
836 |
if ($ldapserv_config['fuzzy_search'] != 1 || |
A |
837 |
$ldapserv_config['global_search'] != 1) |
d75921
|
838 |
{ |
T |
839 |
continue; |
a0530a
|
840 |
} |
d75921
|
841 |
|
T |
842 |
$LDAP = new rcube_ldap($ldapserv_config); |
|
843 |
$LDAP->connect(); |
|
844 |
$LDAP->set_pagesize(1000); |
|
845 |
|
|
846 |
$results = $LDAP->search($ldapserv_config['mail_field'], ""); |
|
847 |
|
|
848 |
for ($i = 0; $i < $results->count; $i++) |
|
849 |
{ |
|
850 |
if ($results->records[$i]['email'] != '') |
|
851 |
{ |
|
852 |
$email = $results->records[$i]['email']; |
|
853 |
$name = $results->records[$i]['name']; |
c658ed
|
854 |
|
0c6f4b
|
855 |
$a_contacts[] = format_email_recipient($email, $name); |
d75921
|
856 |
} |
T |
857 |
} |
|
858 |
$LDAP->close(); |
|
859 |
} |
148e7b
|
860 |
} |
T |
861 |
if ($a_contacts) |
|
862 |
{ |
c658ed
|
863 |
$OUTPUT->set_env('contacts', $a_contacts); |
a0530a
|
864 |
} |
A |
865 |
|
47124c
|
866 |
$OUTPUT->send('compose'); |
a0530a
|
867 |
|
d9344f
|
868 |
?> |