本文整理汇总了PHP中comment::add_comment_from_email方法的典型用法代码示例。如果您正苦于以下问题:PHP comment::add_comment_from_email方法的具体用法?PHP comment::add_comment_from_email怎么用?PHP comment::add_comment_from_email使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类comment
的用法示例。
在下文中一共展示了comment::add_comment_from_email方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_comment_via_email
function add_comment_via_email($commands, $email_receive)
{
// If there's Key in the email, then add a comment with the contents of the email.
$token = new token();
if ($commands["key"] && $token->set_hash($commands["key"])) {
$db = new db_alloc();
$comment = $token->get_value("tokenEntity");
$commentID = $token->get_value("tokenEntityID");
list($entity, $method) = $token->execute();
if (is_object($entity) && $method == "add_comment_from_email") {
$c = comment::add_comment_from_email($email_receive, $entity);
if (is_object($c) && $c->get_id()) {
$quiet = interestedParty::adjust_by_email_subject($email_receive, $entity);
if ($commands["ip"]) {
$rtn = interestedParty::add_remove_ips($commands["ip"], $entity->classname, $entity->get_id(), $entity->get_project_id());
}
if (!$quiet) {
comment::send_comment($c->get_id(), array("interested"), $email_receive);
}
}
}
// Bad or missing key, then error
} else {
if ($email_receive) {
alloc_error("Bad or missing key. Unable to process email.");
}
}
return array($status, $message);
}
示例2: add_comment_from_email
function add_comment_from_email($email_receive, $ignorethis)
{
return comment::add_comment_from_email($email_receive, $this);
}
示例3: attach_email_to_existing_task
function attach_email_to_existing_task($req = array())
{
global $TPL;
$info = inbox::get_mail_info();
$current_user =& singleton("current_user");
$orig_current_user =& $current_user;
$req["taskID"] = sprintf("%d", $req["taskID"]);
$task = new task();
$task->set_id($req["taskID"]);
if ($task->select()) {
$email_receive = new email_receive($info);
$email_receive->open_mailbox($info["folder"]);
$email_receive->set_msg($req["id"]);
$email_receive->get_msg_header();
$email_receive->save_email();
$c = comment::add_comment_from_email($email_receive, $task);
$commentID = $c->get_id();
$commentID and $TPL["message_good_no_esc"][] = "Created comment " . $commentID . " on task " . $task->get_task_link(array("prefixTaskID" => true));
// Possibly change the identity of current_user
list($from_address, $from_name) = parse_email_address($email_receive->mail_headers["from"]);
$person = new person();
$personID = $person->find_by_email($from_address);
$personID or $personID = $person->find_by_name($from_name);
if ($personID) {
$current_user = new person();
$current_user->load_current_user($personID);
singleton("current_user", $current_user);
}
// swap back to normal user
$current_user =& $orig_current_user;
singleton("current_user", $current_user);
// manually add task manager and assignee to ip list
$extraips = array();
if ($task->get_value("personID")) {
$p = new person($task->get_value("personID"));
if ($p->get_value("emailAddress")) {
$extraips[$p->get_value("emailAddress")]["name"] = $p->get_name();
$extraips[$p->get_value("emailAddress")]["role"] = "assignee";
$extraips[$p->get_value("emailAddress")]["personID"] = $task->get_value("personID");
$extraips[$p->get_value("emailAddress")]["selected"] = 1;
}
}
if ($task->get_value("managerID")) {
$p = new person($task->get_value("managerID"));
if ($p->get_value("emailAddress")) {
$extraips[$p->get_value("emailAddress")]["name"] = $p->get_name();
$extraips[$p->get_value("emailAddress")]["role"] = "manager";
$extraips[$p->get_value("emailAddress")]["personID"] = $task->get_value("managerID");
$extraips[$p->get_value("emailAddress")]["selected"] = 1;
}
}
// add all the other interested parties
$ips = interestedParty::get_interested_parties("task", $req["taskID"], $extraips);
foreach ((array) $ips as $k => $inf) {
$inf["entity"] = "comment";
$inf["entityID"] = $commentID;
$inf["email"] and $inf["emailAddress"] = $inf["email"];
if ($req["emailto"] == "internal" && !$inf["external"] && !$inf["clientContactID"]) {
$id = interestedParty::add_interested_party($inf);
$recipients[] = $inf["name"] . " " . add_brackets($k);
} else {
if ($req["emailto"] == "default") {
$id = interestedParty::add_interested_party($inf);
$recipients[] = $inf["name"] . " " . add_brackets($k);
}
}
}
$recipients and $recipients = implode(", ", (array) $recipients);
$recipients and $TPL["message_good"][] = "Sent email to " . $recipients;
// Re-email the comment out
comment::send_comment($commentID, array("interested"), $email_receive);
// File email away in the task's mail folder
$mailbox = "INBOX/task" . $task->get_id();
$email_receive->create_mailbox($mailbox) and $TPL["message_good"][] = "Created mailbox: " . $mailbox;
$email_receive->move_mail($req["id"], $mailbox) and $TPL["message_good"][] = "Moved email " . $req["id"] . " to " . $mailbox;
$email_receive->close();
}
}