break; } //add an attachment $mail->AddStringAttachment($parts_array["Body"], $file, $encoding, $mime_type); if (function_exists(get_transcription)) { $attachments_array = $mail->GetAttachments(); $transcription = get_transcription($attachments_array[0]); echo "Transcription: " . $transcription; } else { $transcription = ''; } } } } //add the body to the email $body_plain = rip_tags($body); //echo "body_plain = $body_plain\n"; if (substr($body, 0, 5) == "<html" || substr($body, 0, 9) == "<!doctype") { $mail->ContentType = "text/html"; $mail->Body = $body . "<br><br>" . nl2br($transcription); $mail->AltBody = $body_plain . "\n\n{$transcription}"; } else { // $mail->Body = ($body != '') ? $body : $body_plain; $mail->Body = $body_plain . "\n\n{$transcription}"; $mail->AltBody = $body_plain . "\n\n{$transcription}"; } //send the email if (!$mail->Send()) { $mailer_error = $mail->ErrorInfo; echo "Mailer Error: " . $mailer_error . "\n\n"; $call_uuid = $headers["X-FusionPBX-Call-UUID"];
function saveEntriesSearchPage($aWhere, $lastEntryId, $pageSize) { $aWhere[] = ' entries.entryId > ' . (int) $lastEntryId; $lastEntryId = null; $values = array(); $query = " SELECT entryId, entryTitle, entryContent, entries.feedId\n\t\t\tFROM entries\n\t\t\tWHERE " . implode(' AND ', $aWhere) . "\n\t\t\tORDER BY entryId ASC\n\t\t\tLIMIT " . $pageSize . " "; // pr($query); die; $query = $this->db->query($query); foreach ($query->result_array() as $data) { $lastEntryId = $data['entryId']; $searchKey = 'searchEntries searchInFeedId' . $data['feedId']; $feed = $this->Feeds_Model->get($data['feedId']); $values[$data['entryId']] = array('entityTypeId' => $this->db->escape(config_item('entityTypeEntry')), 'entityId' => $this->db->escape($data['entryId']), 'entityFullSearch' => $this->db->escape(searchReplace($searchKey . ' ' . $data['entryTitle'] . ' ' . rip_tags($data['entryContent']) . ' ' . $feed['feedName'])), 'entityNameSearch' => $this->db->escape(searchReplace($searchKey . ' ' . $data['entryTitle'] . ' ' . $feed['feedName'])), 'entityName' => $this->db->escape($data['entryTitle'])); } $query->free_result(); if (!empty($values)) { $inserts = array(); foreach ($values as $data) { $inserts[] = "( " . implode(", ", $data) . " )"; } $query = ' INSERT INTO entities_search (entityTypeId, entityId, entityFullSearch, entityNameSearch, entityName) VALUES ' . implode(', ', $inserts) . ' ON DUPLICATE KEY UPDATE entityFullSearch = VALUES(entityFullSearch), entityNameSearch = VALUES(entityNameSearch), entityName = VALUES(entityName) '; //vd($query); die; $this->db->query($query); } unset($values); unset($inserts); return $lastEntryId; }