本文整理汇总了PHP中Issue::getRootMessageID方法的典型用法代码示例。如果您正苦于以下问题:PHP Issue::getRootMessageID方法的具体用法?PHP Issue::getRootMessageID怎么用?PHP Issue::getRootMessageID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Issue
的用法示例。
在下文中一共展示了Issue::getRootMessageID方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildFullHeaders
/**
* Method used to build the headers of a web-based message.
*
* @param integer $issue_id The issue ID
* @param string $message_id The message-id
* @param string $from The sender of this message
* @param string $to The primary recipient of this message
* @param string $cc The extra recipients of this message
* @param string $body The message body
* @param string $in_reply_to The message-id that we are replying to
* @param array $iaf_ids Array with attachment file id-s
* @return string The full email
*/
public static function buildFullHeaders($issue_id, $message_id, $from, $to, $cc, $subject, $body, $in_reply_to, $iaf_ids = null)
{
// hack needed to get the full headers of this web-based email
$mail = new Mail_Helper();
$mail->setTextBody($body);
// FIXME: $body unused, but does mime->get() have side effects?
$body = $mail->mime->get(array('text_charset' => APP_CHARSET, 'head_charset' => APP_CHARSET, 'text_encoding' => APP_EMAIL_ENCODING));
if (!empty($issue_id)) {
$mail->setHeaders(array('Message-Id' => $message_id));
} else {
$issue_id = 0;
}
// if there is no existing in-reply-to header, get the root message for the issue
if ($in_reply_to == false && !empty($issue_id)) {
$in_reply_to = Issue::getRootMessageID($issue_id);
}
if ($in_reply_to) {
$mail->setHeaders(array('In-Reply-To' => $in_reply_to));
}
if ($iaf_ids) {
foreach ($iaf_ids as $iaf_id) {
$attachment = Attachment::getDetails($iaf_id);
$mail->addAttachment($attachment['iaf_filename'], $attachment['iaf_file'], $attachment['iaf_filetype']);
}
}
$cc = trim($cc);
if (!empty($cc)) {
$cc = str_replace(',', ';', $cc);
$ccs = explode(';', $cc);
foreach ($ccs as $address) {
if (!empty($address)) {
$mail->addCc($address);
}
}
}
return $mail->getFullHeaders($from, $to, $subject);
}
示例2: buildFullHeaders
/**
* Method used to build the headers of a web-based message.
*
* @access public
* @param integer $issue_id The issue ID
* @param string $message_id The message-id
* @param string $from The sender of this message
* @param string $to The primary recipient of this message
* @param string $cc The extra recipients of this message
* @param string $body The message body
* @param string $in_reply_to The message-id that we are replying to
* @return string The full email
*/
function buildFullHeaders($issue_id, $message_id, $from, $to, $cc, $subject, $body, $in_reply_to)
{
// hack needed to get the full headers of this web-based email
$mail = new Mail_API();
$mail->setTextBody($body);
if (!empty($issue_id)) {
$mail->setHeaders(array("Message-Id" => $message_id));
} else {
$issue_id = 0;
}
// if there is no existing in-reply-to header, get the root message for the issue
if ($in_reply_to == false && !empty($issue_id)) {
$in_reply_to = Issue::getRootMessageID($issue_id);
}
if ($in_reply_to) {
$mail->setHeaders(array("In-Reply-To" => $in_reply_to));
}
$cc = trim($cc);
if (!empty($cc)) {
$cc = str_replace(",", ";", $cc);
$ccs = explode(";", $cc);
for ($i = 0; $i < count($ccs); $i++) {
if (!empty($ccs[$i])) {
$mail->addCc($ccs[$i]);
}
}
}
return $mail->getFullHeaders($from, $to, $subject);
}
示例3: getBaseThreadingHeaders
function getBaseThreadingHeaders($issue_id)
{
$root_msg_id = Issue::getRootMessageID($issue_id);
return array("Message-ID" => Mail_API::generateMessageID(), "In-Reply-To" => $root_msg_id, "References" => $root_msg_id);
}
示例4: getBaseThreadingHeaders
public static function getBaseThreadingHeaders($issue_id)
{
$root_msg_id = Issue::getRootMessageID($issue_id);
return array('Message-ID' => self::generateMessageID(), 'In-Reply-To' => $root_msg_id, 'References' => $root_msg_id);
}
示例5: notify
//.........这里部分代码省略.........
}
}
$emails = array();
$users = self::getUsersByIssue($issue_id, $type);
if ($extra_recipients && count($extra) > 0) {
$users = array_merge($users, $extra);
}
$user_emails = Project::getUserEmailAssocList(Issue::getProjectID($issue_id), 'active', User::ROLE_CUSTOMER);
$user_emails = Misc::lowercase($user_emails);
foreach ($users as $user) {
if (empty($user['sub_usr_id'])) {
if ($internal_only == false || in_array(strtolower($user['sub_email']), array_values($user_emails))) {
$email = $user['sub_email'];
}
} else {
$prefs = Prefs::get($user['sub_usr_id']);
if (Auth::getUserID() == $user['sub_usr_id'] && (empty($prefs['receive_copy_of_own_action'][$prj_id]) || $prefs['receive_copy_of_own_action'][$prj_id] == false)) {
continue;
}
// if we are only supposed to send email to internal users, check if the role is lower than standard user
if ($internal_only == true && User::getRoleByUser($user['sub_usr_id'], Issue::getProjectID($issue_id)) < User::ROLE_USER) {
continue;
}
if ($type == 'notes' && User::isPartner($user['sub_usr_id']) && !Partner::canUserAccessIssueSection($user['sub_usr_id'], 'notes')) {
continue;
}
$email = User::getFromHeader($user['sub_usr_id']);
}
// now add it to the list of emails
if (!empty($email) && !in_array($email, $emails)) {
$emails[] = $email;
}
}
// prevent the primary customer contact from receiving two emails about the issue being closed
if ($type == 'closed') {
if (CRM::hasCustomerIntegration($prj_id)) {
$crm = CRM::getInstance($prj_id);
$stmt = 'SELECT
iss_customer_contact_id
FROM
{{%issue}}
WHERE
iss_id=?';
$customer_contact_id = DB_Helper::getInstance()->getOne($stmt, array($issue_id));
if (!empty($customer_contact_id)) {
try {
$contact = $crm->getContact($customer_contact_id);
$contact_email = $contact->getEmail();
} catch (CRMException $e) {
$contact_email = '';
}
foreach ($emails as $i => $email) {
$email = Mail_Helper::getEmailAddress($email);
if ($email == $contact_email) {
unset($emails[$i]);
$emails = array_values($emails);
break;
}
}
}
}
}
if (!$emails) {
return null;
}
$headers = false;
switch ($type) {
case 'closed':
$data = Issue::getDetails($issue_id);
$data['closer_name'] = User::getFullName(History::getIssueCloser($issue_id));
$subject = ev_gettext('Closed');
if ($entry_id) {
$data['reason'] = Support::getEmail($entry_id);
}
break;
case 'updated':
// this should not be used anymore
return false;
case 'notes':
$data = self::getNote($issue_id, $entry_id);
$headers = array('Message-ID' => $data['note']['not_message_id']);
if (@$data['note']['reference_msg_id'] != false) {
$headers['In-Reply-To'] = $data['note']['reference_msg_id'];
} else {
$headers['In-Reply-To'] = Issue::getRootMessageID($issue_id);
}
$headers['References'] = Mail_Helper::fold(implode(' ', Mail_Helper::getReferences($issue_id, @$data['note']['reference_msg_id'], 'note')));
$subject = 'Note';
break;
case 'emails':
// this should not be used anymore
return false;
case 'files':
$data = self::getAttachment($issue_id, $entry_id);
$subject = 'File Attached';
break;
}
// FIXME: $data and $subject might be used uninitialized
self::notifySubscribers($issue_id, $emails, $type, $data, $subject, $internal_only, $entry_id, $headers);
}
示例6: notify
/**
* Method used to send email notifications for a given issue.
*
* @access public
* @param integer $issue_id The issue ID
* @param string $type The notification type
* @param array $ids The list of entries that were changed
* @param integer $internal_only Whether the notification should only be sent to internal users or not
* @return void
*/
function notify($issue_id, $type, $ids = FALSE, $internal_only = FALSE, $extra_recipients = FALSE)
{
if ($extra_recipients) {
$extra = array();
for ($i = 0; $i < count($extra_recipients); $i++) {
$extra[] = array('sub_usr_id' => $extra_recipients[$i], 'sub_email' => '');
}
}
$emails = array();
$users = Notification::getUsersByIssue($issue_id, $type);
if ($extra_recipients && count($extra) > 0) {
$users = array_merge($users, $extra);
}
$user_emails = Project::getUserEmailAssocList(Issue::getProjectID($issue_id), 'active', User::getRoleID('Customer'));
$user_emails = array_map('strtolower', $user_emails);
for ($i = 0; $i < count($users); $i++) {
if (empty($users[$i]["sub_usr_id"])) {
if ($internal_only == false || in_array(strtolower($users[$i]["sub_email"]), array_values($user_emails))) {
$email = $users[$i]["sub_email"];
}
} else {
// don't send the notification email to the person who performed the action
if (Auth::getUserID() == $users[$i]["sub_usr_id"]) {
continue;
}
// if we are only supposed to send email to internal users, check if the role is lower than standard user
if ($internal_only == true && User::getRoleByUser($users[$i]["sub_usr_id"], Issue::getProjectID($issue_id)) < User::getRoleID('standard user')) {
continue;
}
$email = User::getFromHeader($users[$i]["sub_usr_id"]);
}
// now add it to the list of emails
if (!empty($email) && !in_array($email, $emails)) {
$emails[] = $email;
}
}
// prevent the primary customer contact from receiving two emails about the issue being closed
if ($type == 'closed') {
$stmt = "SELECT\r\n iss_customer_contact_id\r\n FROM\r\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue\r\n WHERE\r\n iss_id=" . Misc::escapeInteger($issue_id);
$customer_contact_id = $GLOBALS["db_api"]->dbh->getOne($stmt);
if (!empty($customer_contact_id)) {
list($contact_email, , ) = Customer::getContactLoginDetails(Issue::getProjectID($issue_id), $customer_contact_id);
for ($i = 0; $i < count($emails); $i++) {
$email = Mail_API::getEmailAddress($emails[$i]);
if ($email == $contact_email) {
unset($emails[$i]);
$emails = array_values($emails);
break;
}
}
}
}
if (count($emails) > 0) {
$headers = false;
switch ($type) {
case 'closed':
$data = Notification::getIssueDetails($issue_id);
$data["closer_name"] = User::getFullName(History::getIssueCloser($issue_id));
$subject = 'Closed';
if ($ids != false) {
$data['reason'] = Support::getEmail($ids);
}
break;
case 'updated':
// this should not be used anymore
return false;
break;
case 'notes':
$data = Notification::getNote($issue_id, $ids);
$headers = array('Message-ID' => $data['note']['not_message_id']);
if (@$data['note']['reference_msg_id'] != false) {
$headers['In-Reply-To'] = $data['note']['reference_msg_id'];
} else {
$headers['In-Reply-To'] = Issue::getRootMessageID($issue_id);
}
$headers['References'] = Mail_API::fold(join(' ', Mail_API::getReferences($issue_id, @$data['note']['reference_msg_id'], 'note')));
$subject = 'Note';
break;
case 'emails':
// this should not be used anymore
return false;
break;
case 'files':
$data = Notification::getAttachment($issue_id, $ids);
$subject = 'File Attached';
break;
}
Notification::notifySubscribers($issue_id, $emails, $type, $data, $subject, $internal_only, $ids, $headers);
}
}