当前位置: 首页>>代码示例>>PHP>>正文


PHP Support::isAllowedToEmail方法代码示例

本文整理汇总了PHP中Support::isAllowedToEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP Support::isAllowedToEmail方法的具体用法?PHP Support::isAllowedToEmail怎么用?PHP Support::isAllowedToEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Support的用法示例。


在下文中一共展示了Support::isAllowedToEmail方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isset

if ($cat == 'reply') {
    $details = Issue::getReplyDetails($_GET['issue_id']);
    if ($details != '') {
        $header = Misc::formatReplyPreamble($details['created_date_ts'], $details['reporter']);
        $details['seb_body'] = $header . Misc::formatReply($details['description']);
        $details['sup_from'] = Mail_Helper::getFormattedName($details['reporter'], $details['reporter_email']);
        $tpl->assign(array('email' => $details, 'parent_email_id' => 0, 'extra_title' => 'Issue #' . $_GET['issue_id'] . ': Reply'));
    }
}
if (!empty($issue_id)) {
    // list the available statuses
    $tpl->assign('statuses', Status::getAssocStatusList($prj_id, false));
    $tpl->assign('current_issue_status', Issue::getStatusID($issue_id));
    // set if the current user is allowed to send emails on this issue or not
    $sender_details = User::getDetails($usr_id);
    $tpl->assign('can_send_email', Support::isAllowedToEmail($issue_id, $sender_details['usr_email']));
    $tpl->assign('subscribers', Notification::getSubscribers($issue_id, 'emails'));
}
if (!empty($_GET['ema_id']) || !empty($_POST['ema_id'])) {
    $ema_id = isset($_GET['ema_id']) ? (int) $_GET['ema_id'] : (isset($_POST['ema_id']) ? (int) $_POST['ema_id'] : null);
    $tpl->assign('ema_id', $ema_id);
}
$user_prefs = Prefs::get($usr_id);
// list of users to display in the lookup field in the To: and Cc: fields
$t = Project::getAddressBook($prj_id, $issue_id);
$tpl->assign(array('from' => User::getFromHeader($usr_id), 'assoc_users' => $t, 'assoc_emails' => array_keys($t), 'canned_responses' => Email_Response::getAssocList($prj_id), 'js_canned_responses' => Email_Response::getAssocListBodies($prj_id), 'current_user_prefs' => $user_prefs, 'issue_access' => Access::getIssueAccessArray($issue_id, $usr_id), 'max_attachment_size' => Attachment::getMaxAttachmentSize(), 'max_attachment_bytes' => Attachment::getMaxAttachmentSize(true)));
// don't add signature if it already exists. Note: This won't handle multiple user duplicate sigs.
if (@(!empty($draft['emd_body'])) && $user_prefs['auto_append_email_sig'] == 1 && strpos($draft['emd_body'], $user_prefs['email_signature']) !== false) {
    $tpl->assign('body_has_sig_already', 1);
}
$tpl->displayTemplate();
开发者ID:korusdipl,项目名称:eventum,代码行数:31,代码来源:send.php

示例2: blockEmailIfNeeded

 /**
  * Check if this email needs to be blocked and if so, block it.
  *
  *
  */
 function blockEmailIfNeeded($email)
 {
     global $HTTP_POST_VARS;
     if (empty($email['issue_id'])) {
         return false;
     }
     $issue_id = $email['issue_id'];
     $prj_id = Issue::getProjectID($issue_id);
     $sender_email = strtolower(Mail_API::getEmailAddress($email['headers']['from']));
     if (Mail_API::isVacationAutoResponder($email['headers']) || Notification::isBounceMessage($sender_email) || !Support::isAllowedToEmail($issue_id, $sender_email)) {
         // add the message body as a note
         $HTTP_POST_VARS = array('blocked_msg' => $email['full_email'], 'title' => @$email['headers']['subject'], 'note' => Mail_API::getCannedBlockedMsgExplanation($issue_id) . $email['body']);
         // avoid having this type of message re-open the issue
         if (Mail_API::isVacationAutoResponder($email['headers'])) {
             $closing = true;
         } else {
             $closing = false;
         }
         $res = Note::insert(Auth::getUserID(), $issue_id, $email['headers']['from'], false, $closing);
         // associate the email attachments as internal-only files on this issue
         if ($res != -1) {
             Support::extractAttachments($issue_id, $email['full_email'], true, $res);
         }
         $HTTP_POST_VARS['issue_id'] = $issue_id;
         $HTTP_POST_VARS['from'] = $sender_email;
         // avoid having this type of message re-open the issue
         if (Mail_API::isVacationAutoResponder($email['headers'])) {
             $email_type = 'vacation-autoresponder';
         } else {
             $email_type = 'routed';
         }
         Workflow::handleBlockedEmail($prj_id, $issue_id, $HTTP_POST_VARS, $email_type);
         // try to get usr_id of sender, if not, use system account
         $usr_id = User::getUserIDByEmail(Mail_API::getEmailAddress($email['from']));
         if (!$usr_id) {
             $usr_id = APP_SYSTEM_USER_ID;
         }
         // log blocked email
         History::add($issue_id, $usr_id, History::getTypeID('email_blocked'), "Email from '" . $email['from'] . "' blocked.");
         return true;
     }
     return false;
 }
开发者ID:juliogallardo1326,项目名称:proc,代码行数:48,代码来源:class.support.php

示例3: addWarningMessage

 /**
  * Method used to add a customized warning message to the body
  * of outgoing emails.
  *
  * @param   integer $issue_id The issue ID
  * @param   string $to The recipient of the message
  * @param   string $body The body of the message
  * @param   array $headers The headers of the message
  * @return  string The body of the message with the warning message, if appropriate
  */
 public static function addWarningMessage($issue_id, $to, $body, $headers)
 {
     $setup = Setup::load();
     if (@$setup['email_routing']['status'] == 'enabled' && $setup['email_routing']['warning']['status'] == 'enabled') {
         // check if the recipient can send emails to the customer
         $recipient_email = self::getEmailAddress($to);
         $recipient_usr_id = User::getUserIDByEmail($recipient_email);
         // don't add the warning message if the recipient is an unknown email address
         if (empty($recipient_usr_id)) {
             return $body;
         } else {
             // don't add anything if the recipient is a known customer contact
             $recipient_role_id = User::getRoleByUser($recipient_usr_id, Issue::getProjectID($issue_id));
             if ($recipient_role_id == User::getRoleID('Customer')) {
                 return $body;
             } else {
                 if (!Support::isAllowedToEmail($issue_id, $recipient_email)) {
                     $warning = self::getWarningMessage('blocked');
                 } else {
                     $warning = self::getWarningMessage('allowed');
                 }
                 if (@$headers['Content-Transfer-Encoding'] == 'base64') {
                     return base64_encode($warning . "\n\n" . trim(base64_decode($body)));
                 } else {
                     return $warning . "\n\n" . $body;
                 }
             }
         }
     } else {
         return $body;
     }
 }
开发者ID:korusdipl,项目名称:eventum,代码行数:42,代码来源:class.mail_helper.php

示例4: addWarningMessage

 /**
  * Method used to add a customized warning message to the body
  * of outgoing emails.
  *
  * @access  public
  * @param   integer $issue_id The issue ID
  * @param   string $to The recipient of the message
  * @param   string $body The body of the message
  * @return  string The body of the message with the warning message, if appropriate
  */
 function addWarningMessage($issue_id, $to, $body)
 {
     $setup = Setup::load();
     if (@$setup['email_routing']['status'] == 'enabled' && $setup['email_routing']['warning']['status'] == 'enabled') {
         // check if the recipient can send emails to the customer
         $recipient_email = Mail_API::getEmailAddress($to);
         $recipient_usr_id = User::getUserIDByEmail($recipient_email);
         // don't add the warning message if the recipient is an unknown email address
         if (empty($recipient_usr_id)) {
             return $body;
         } else {
             // don't add anything if the recipient is a known customer contact
             $recipient_role_id = User::getRoleByUser($recipient_usr_id, Issue::getProjectID($issue_id));
             if ($recipient_role_id == User::getRoleID('Customer')) {
                 return $body;
             } else {
                 if (!Support::isAllowedToEmail($issue_id, $recipient_email)) {
                     return Mail_API::getWarningMessage('blocked') . "\n\n" . $body;
                 } else {
                     return Mail_API::getWarningMessage('allowed') . "\n\n" . $body;
                 }
             }
         }
     } else {
         return $body;
     }
 }
开发者ID:juliogallardo1326,项目名称:proc,代码行数:37,代码来源:class.mail.php

示例5:

    $details = Issue::getReplyDetails($HTTP_GET_VARS['issue_id']);
    if ($details != '') {
        $date = Misc::formatReplyDate($details['created_date_ts']);
        $header = "To " . $details["reporter"] . ",\n\n\nThank you, \n" . Auth::getCurrentProjectName() . "\n\nOn {$date}, " . $details['reporter'] . " wrote:\n>\n";
        $details['seb_body'] = $header . Misc::formatReply($details['description']);
        $details['sup_from'] = Mail_API::getFormattedName($details['reporter'], $details['reporter_email']);
        $tpl->bulkAssign(array("email" => $details, "parent_email_id" => 0, "extra_title" => "Issue #" . $HTTP_GET_VARS['issue_id'] . ": Reply"));
    }
}
if (!empty($issue_id)) {
    // list the available statuses
    $tpl->assign("statuses", Status::getAssocStatusList($prj_id, false));
    $tpl->assign("current_issue_status", Issue::getStatusID($issue_id));
    // set if the current user is allowed to send emails on this issue or not
    $sender_details = User::getDetails($usr_id);
    $tpl->assign("can_send_email", Support::isAllowedToEmail($issue_id, $sender_details["usr_email"]));
}
if (!@empty($HTTP_GET_VARS["ema_id"]) || !@empty($HTTP_POST_VARS["ema_id"])) {
    @$tpl->assign("ema_id", $HTTP_GET_VARS["ema_id"] ? $HTTP_GET_VARS["ema_id"] : $HTTP_POST_VARS["ema_id"]);
}
$tpl->assign("from", User::getFromHeader($usr_id));
// list of users to display in the lookup field in the To: and Cc: fields
$t = Project::getAddressBook($prj_id, $issue_id);
$tpl->assign("assoc_users", $t);
$tpl->assign("assoc_emails", array_keys($t));
$tpl->assign("canned_responses", Email_Response::getAssocList($prj_id));
$tpl->assign("js_canned_responses", Email_Response::getAssocListBodies($prj_id));
$tpl->assign('subscribers', Notification::getSubscribers($issue_id, 'emails'));
$user_prefs = Prefs::get($usr_id);
$tpl->assign("current_user_prefs", $user_prefs);
// don't add signature if it already exists. Note: This won't handle multiple user duplicate sigs.
开发者ID:juliogallardo1326,项目名称:proc,代码行数:31,代码来源:send.php


注:本文中的Support::isAllowedToEmail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。