} } } } if (!$error) { $recipients = array(); if (empty($message['customerid'])) { if ($message['type'] != MSG_ANYSMS) { $recipients = GetRecipients($message, $message['type']); } else { foreach ($phonenumbers as $phone) { $recipients[]['phone'] = $phone; } } } else { $recipient = GetRecipient($message['customerid']); if (!empty($recipient)) { switch ($message['type']) { case MSG_MAIL: if (empty($message['customermails'])) { break; } $recipient['email'] = implode(',', $message['customermails']); $recipients = array($recipient); break; case MSG_SMS: if (empty($message['customerphones'])) { break; } $recipient['phone'] = implode(',', $message['customerphones']); $recipients = array($recipient);
break; } } } if (!$error) { $recipients = array(); if (empty($message['customerid'])) { if ($message['type'] != MSG_ANYSMS) { $recipients = GetRecipients($message, $message['type']); } else { foreach ($phonenumbers as $phone) { $recipients[]['phone'] = $phone; } } } else { $recipients = GetRecipient($message['customerid'], $message['type']); } if (!$recipients) { $error['subject'] = trans('Unable to send message. No recipients selected!'); } } if (!$error) { set_time_limit(0); $message['body'] = str_replace("\r", '', $message['body']); if ($message['type'] == MSG_MAIL) { $message['body'] = wordwrap($message['body'], 76, "\n"); } $SMARTY->assign('message', $message); $SMARTY->assign('recipcount', sizeof($recipients)); $SMARTY->display('messagesend.html'); $DB->BeginTrans();