本文整理汇总了PHP中CerberusApplication::hashLookupAddress方法的典型用法代码示例。如果您正苦于以下问题:PHP CerberusApplication::hashLookupAddress方法的具体用法?PHP CerberusApplication::hashLookupAddress怎么用?PHP CerberusApplication::hashLookupAddress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CerberusApplication
的用法示例。
在下文中一共展示了CerberusApplication::hashLookupAddress方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _handleImportComment
private function _handleImportComment($xml)
{
$mask = (string) $xml->mask;
$author_email = (string) $xml->author_email;
$note = trim((string) $xml->note);
$created = intval((string) $xml->created_date);
$author_address = CerberusApplication::hashLookupAddress($author_email, true);
// Bad file
if (empty($note) || empty($author_address) || empty($mask)) {
return false;
}
// echo "MASK: ",$mask,"<BR>";
// echo " -- Author: ",$author_address->email,"<BR>";
// echo " -- Note: ",$note,"<BR>";
if (null !== ($ticket = DAO_Ticket::getTicketByMask($mask))) {
$fields = array(DAO_TicketComment::CREATED => $created, DAO_TicketComment::TICKET_ID => $ticket->id, DAO_TicketComment::COMMENT => $note, DAO_TicketComment::ADDRESS_ID => $author_address->id);
if (null !== ($comment_id = DAO_TicketComment::create($fields))) {
return true;
}
}
return false;
}
示例2: parseMessage
//.........这里部分代码省略.........
}
}
// [JAS]: Add requesters to the ticket
if (!empty($fromAddressInst->id) && !empty($id)) {
// Don't add a requester if the sender is a helpdesk address
if (isset($helpdesk_senders[$fromAddressInst->email])) {
$logger->info("[Parser] Not adding ourselves as a requester: " . $fromAddressInst->email);
} else {
DAO_Ticket::createRequester($fromAddressInst->id, $id);
}
}
// Add the other TO/CC addresses to the ticket
// [TODO] This should be cleaned up and optimized
if ($settings->get('cerberusweb.core', CerberusSettings::PARSER_AUTO_REQ, 0)) {
@($autoreq_exclude_list = $settings->get('cerberusweb.core', CerberusSettings::PARSER_AUTO_REQ_EXCLUDE, ''));
$destinations = self::getDestinations($headers);
if (is_array($destinations) && !empty($destinations)) {
// Filter out any excluded requesters
if (!empty($autoreq_exclude_list)) {
@($autoreq_exclude = DevblocksPlatform::parseCrlfString($autoreq_exclude_list));
if (is_array($autoreq_exclude) && !empty($autoreq_exclude)) {
foreach ($autoreq_exclude as $excl_pattern) {
$excl_regexp = DevblocksPlatform::parseStringAsRegExp($excl_pattern);
// Check all destinations for this pattern
foreach ($destinations as $idx => $dest) {
if (@preg_match($excl_regexp, $dest)) {
unset($destinations[$idx]);
}
}
}
}
}
foreach ($destinations as $dest) {
if (null != ($destInst = CerberusApplication::hashLookupAddress($dest, true))) {
// Skip if the destination is one of our senders or the matching TO
if (isset($helpdesk_senders[$destInst->email])) {
continue;
}
DAO_Ticket::createRequester($destInst->id, $id);
}
}
}
}
$attachment_path = APP_STORAGE_PATH . '/attachments/';
// [TODO] This should allow external attachments (S3)
$fields = array(DAO_Message::TICKET_ID => $id, DAO_Message::CREATED_DATE => $iDate, DAO_Message::ADDRESS_ID => $fromAddressInst->id);
$email_id = DAO_Message::create($fields);
// Content
DAO_MessageContent::create($email_id, $message->body);
// Headers
foreach ($headers as $hk => $hv) {
DAO_MessageHeader::create($email_id, $hk, $hv);
}
// [mdf] Loop through files to insert attachment records in the db, and move temporary files
if (!empty($email_id)) {
foreach ($message->files as $filename => $file) {
/* @var $file ParserFile */
//[mdf] skip rfc822 messages since we extracted their content above
if ($file->mime_type == 'message/rfc822') {
continue;
}
$fields = array(DAO_Attachment::MESSAGE_ID => $email_id, DAO_Attachment::DISPLAY_NAME => $filename, DAO_Attachment::MIME_TYPE => $file->mime_type, DAO_Attachment::FILE_SIZE => intval($file->file_size));
$file_id = DAO_Attachment::create($fields);
if (empty($file_id)) {
@unlink($file->tmpname);
// remove our temp file
示例3: saveRequestersPanelAction
function saveRequestersPanelAction()
{
@($ticket_id = DevblocksPlatform::importGPC($_POST['ticket_id'], 'integer'));
@($msg_id = DevblocksPlatform::importGPC($_POST['msg_id'], 'integer'));
// Dels
@($req_deletes = DevblocksPlatform::importGPC($_POST['req_deletes'], 'array', array()));
if (!empty($req_deletes)) {
foreach ($req_deletes as $del_id) {
DAO_Ticket::deleteRequester($ticket_id, $del_id);
}
}
// Adds
@($req_adds = DevblocksPlatform::importGPC($_POST['req_adds'], 'string', ''));
$req_list = DevblocksPlatform::parseCrlfString($req_adds);
$req_addys = array();
if (is_array($req_list) && !empty($req_list)) {
foreach ($req_list as $req) {
if (empty($req)) {
continue;
}
$rfc_addys = imap_rfc822_parse_adrlist($req, 'localhost');
foreach ($rfc_addys as $rfc_addy) {
$addy = $rfc_addy->mailbox . '@' . $rfc_addy->host;
if (null != ($req_addy = CerberusApplication::hashLookupAddress($addy, true))) {
DAO_Ticket::createRequester($req_addy->id, $ticket_id);
}
}
}
}
$requesters = DAO_Ticket::getRequestersByTicket($ticket_id);
$list = array();
foreach ($requesters as $requester) {
$list[] = $requester->email;
}
echo implode(', ', $list);
exit;
}
示例4: doImportAction
function doImportAction()
{
$active_worker = CerberusApplication::getActiveWorker();
if (!$active_worker->hasPriv('crm.opp.actions.import')) {
return;
}
@($pos = DevblocksPlatform::importGPC($_REQUEST['pos'], 'array', array()));
@($field = DevblocksPlatform::importGPC($_REQUEST['field'], 'array', array()));
@($sync_dupes = DevblocksPlatform::importGPC($_REQUEST['sync_dupes'], 'array', array()));
@($include_first = DevblocksPlatform::importGPC($_REQUEST['include_first'], 'integer', 0));
@($is_blank_unset = DevblocksPlatform::importGPC($_REQUEST['is_blank_unset'], 'integer', 0));
@($opt_assign = DevblocksPlatform::importGPC($_REQUEST['opt_assign'], 'integer', 0));
@($opt_assign_worker_id = DevblocksPlatform::importGPC($_REQUEST['opt_assign_worker_id'], 'integer', 0));
$visit = CerberusApplication::getVisit();
$db = DevblocksPlatform::getDatabaseService();
$workers = DAO_Worker::getAllActive();
$csv_file = $visit->get('crm.import.last.csv', '');
$fp = fopen($csv_file, "rt");
if (!$fp) {
return;
}
// [JAS]: Do we need to consume a first row of headings?
if (!$include_first) {
@fgetcsv($fp, 8192, ',', '"');
}
while (!feof($fp)) {
$parts = fgetcsv($fp, 8192, ',', '"');
if (empty($parts) || 1 == count($parts) && is_null($parts[0])) {
continue;
}
$fields = array();
$custom_fields = array();
$sync_fields = array();
foreach ($pos as $idx => $p) {
$key = $field[$idx];
$val = $parts[$idx];
// Special handling
if (!empty($key)) {
switch ($key) {
case 'amount':
if (0 != strlen($val) && is_numeric($val)) {
@($val = floatval($val));
} else {
unset($key);
}
break;
// Translate e-mail address to ID
// Translate e-mail address to ID
case 'email':
if (null != ($addy = CerberusApplication::hashLookupAddress($val, true))) {
$key = 'primary_email_id';
$val = $addy->id;
} else {
unset($key);
}
break;
// Bools
// Bools
case 'is_won':
case 'is_closed':
if (0 != strlen($val)) {
@($val = !empty($val) ? 1 : 0);
} else {
unset($key);
}
break;
// Dates
// Dates
case 'created_date':
case 'updated_date':
case 'closed_date':
if (0 != strlen($val)) {
@($val = !is_numeric($val) ? strtotime($val) : $val);
} else {
unset($key);
}
break;
// Worker by name
// Worker by name
case 'worker':
unset($key);
if (is_array($workers)) {
foreach ($workers as $worker_id => $worker) {
if (0 == strcasecmp($val, $worker->getName())) {
$key = 'worker_id';
$val = $worker_id;
}
}
}
break;
}
if (!isset($key)) {
continue;
}
// Custom fields
if ('cf_' == substr($key, 0, 3)) {
$custom_fields[substr($key, 3)] = $val;
} elseif (!empty($key)) {
$fields[$key] = $val;
}
//.........这里部分代码省略.........
示例5: sendTicketMessage
//.........这里部分代码省略.........
if (empty($file) || empty($files['name'][$idx])) {
continue;
}
$mail->attach(Swift_Attachment::fromPath($file)->setFilename($files['name'][$idx]));
}
}
// Forward Attachments
if (!empty($forward_files) && is_array($forward_files)) {
$attachments_path = APP_STORAGE_PATH . '/attachments/';
foreach ($forward_files as $file_id) {
$attachment = DAO_Attachment::get($file_id);
$attachment_path = $attachments_path . $attachment->filepath;
$mail->attach(Swift_Attachment::fromPath($attachment_path)->setFilename($attachment->display_name));
}
}
if (!DEMO_MODE) {
// If we're not supposed to send
if (isset($properties['dont_send']) && $properties['dont_send']) {
// ...do nothing
} else {
// otherwise send
if (!$mailer->send($mail)) {
$mail_succeeded = false;
throw new Exception('Mail not sent.');
}
}
}
} catch (Exception $e) {
// tag failure, so we can add a note to the message later
$mail_succeeded = false;
}
// Handle post-mail actions
$change_fields = array();
$fromAddressInst = CerberusApplication::hashLookupAddress($from_addy, true);
$fromAddressId = $fromAddressInst->id;
if ((!isset($properties['dont_keep_copy']) || !$properties['dont_keep_copy']) && (!isset($properties['is_autoreply']) || !$properties['is_autoreply'])) {
$change_fields[DAO_Ticket::LAST_WROTE_ID] = $fromAddressId;
$change_fields[DAO_Ticket::UPDATED_DATE] = time();
if (!empty($worker_id)) {
$change_fields[DAO_Ticket::LAST_WORKER_ID] = $worker_id;
$change_fields[DAO_Ticket::LAST_ACTION_CODE] = CerberusTicketActionCode::TICKET_WORKER_REPLY;
}
// Only change the subject if not forwarding
if (!empty($subject) && empty($properties['to'])) {
$change_fields[DAO_Ticket::SUBJECT] = $subject;
}
$fields = array(DAO_Message::TICKET_ID => $ticket_id, DAO_Message::CREATED_DATE => time(), DAO_Message::ADDRESS_ID => $fromAddressId, DAO_Message::IS_OUTGOING => 1, DAO_Message::WORKER_ID => !empty($worker_id) ? $worker_id : 0);
$message_id = DAO_Message::create($fields);
// Content
DAO_MessageContent::create($message_id, $content);
$headers = $mail->getHeaders();
// Headers
foreach ($headers->getAll() as $hdr) {
if (null != ($hdr_val = $hdr->getFieldBody())) {
if (!empty($hdr_val)) {
DAO_MessageHeader::create($message_id, $hdr->getFieldName(), CerberusParser::fixQuotePrintableString($hdr_val));
}
}
}
// Attachments
if (is_array($files) && !empty($files)) {
$attachment_path = APP_STORAGE_PATH . '/attachments/';
reset($files);
foreach ($files['tmp_name'] as $idx => $file) {
if (empty($file) || empty($files['name'][$idx]) || !file_exists($file)) {
continue;
示例6: AnswernetMetlifeReportGroupReport1Action
//.........这里部分代码省略.........
$row_outbound = 2;
$in_count_admin = array();
$in_count_other = array();
$out_count_admin = array();
$out_count_other = array();
if (is_a($rs, 'ADORecordSet')) {
while (!$rs->EOF) {
$mask = $rs->fields['mask'];
$ticket_created_date = intval($rs->fields['ticket_created_date']);
$team_id = intval($rs->fields['team_id']);
// Date Format Month/Day/Year Hour:Min:Sec AM/PM
$message_created_date = date("n/j/y g:i:s A", intval($rs->fields['message_created_date']));
$message_content = $rs->fields['content'];
$message_subject = $rs->fields['message_subject'];
$worker_id = $rs->fields['worker_id'];
$is_outgoing = $rs->fields['is_outgoing'];
if ($team_id == 756) {
$team_text = 'First Person';
} elseif ($team_id == 782) {
$team_text = 'iDesign';
} else {
$team_text = 'Error';
}
if ($worker_id) {
$worker_name = $workers[$worker_id]->first_name;
} else {
$worker_name = "";
}
if ($is_outgoing) {
$outbound_email = $rs->fields['outbound_email'];
$to = array();
$to = CerberusParser::parseRfcAddress($outbound_email);
@($toAddress = $to[0]->mailbox . '@' . $to[0]->host);
$toAddressInst = CerberusApplication::hashLookupAddress($toAddress, true);
$address_id = $toAddressInst->id;
$contact_org_id = $toAddressInst->contact_org_id;
$email = $toAddressInst->email;
} else {
$address_id = $rs->fields['address_id'];
$contact_org_id = $rs->fields['contact_org_id'];
$email = $rs->fields['email'];
}
if ($is_outgoing) {
$worksheet_outbound->setRow($row_outbound, 12);
$worksheet_outbound->write($row_outbound, 0, $email, $format_general);
$worksheet_outbound->write($row_outbound, 1, "", $format_general);
$worksheet_outbound->write($row_outbound, 2, "", $format_general);
$worksheet_outbound->write($row_outbound, 3, $message_created_date, $format_general);
$worksheet_outbound->write($row_outbound, 4, $mask, $format_general);
$worksheet_outbound->write($row_outbound, 5, trim($message_subject), $format_general_nowrap);
$worksheet_outbound->write($row_outbound, 6, trim(strip_tags($message_content)));
$worksheet_outbound->writeString($row_outbound, 10, $worker_name, $format_general);
$worksheet_outbound->write($row_outbound, 11, $team_text, $format_general);
$row_outbound++;
} else {
$worksheet_inbound->setRow($row_inbound, 12);
$worksheet_inbound->write($row_inbound, 0, $email, $format_general);
$worksheet_inbound->write($row_inbound, 1, "", $format_general);
$worksheet_inbound->write($row_inbound, 2, "", $format_general);
$worksheet_inbound->write($row_inbound, 3, $message_created_date, $format_general);
$worksheet_inbound->write($row_inbound, 4, $mask, $format_general);
$worksheet_inbound->write($row_inbound, 5, trim($message_subject), $format_general_nowrap);
$worksheet_inbound->writeString($row_inbound, 6, trim(strip_tags($message_content)));
$worksheet_inbound->write($row_inbound, 10, $team_text, $format_general);
$row_inbound++;
}