本文整理汇总了PHP中comment::update_mime_parts方法的典型用法代码示例。如果您正苦于以下问题:PHP comment::update_mime_parts方法的具体用法?PHP comment::update_mime_parts怎么用?PHP comment::update_mime_parts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类comment
的用法示例。
在下文中一共展示了comment::update_mime_parts方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_comment_from_email
function add_comment_from_email($email_receive, $entity)
{
$current_user =& singleton("current_user");
$commentID = comment::add_comment($entity->classname, $entity->get_id(), $email_receive->get_converted_encoding());
$commentID or alloc_error("Unable to create an alloc comment (" . $entity->classname . ":" . $entity->get_id() . ") from email.");
$comment = new comment();
$comment->set_id($commentID);
$comment->select();
$comment->set_value("commentEmailUID", $email_receive->msg_uid);
$comment->set_value("commentEmailMessageID", $email_receive->mail_headers["message-id"]);
$comment->rename_email_attachment_dir($email_receive->dir);
// Try figure out and populate the commentCreatedUser/commentCreatedUserClientContactID fields
list($from_address, $from_name) = parse_email_address($email_receive->mail_headers["from"]);
list($personID, $clientContactID, $from_name) = comment::get_person_and_client($from_address, $from_name, $entity->get_project_id());
$personID and $comment->set_value('commentCreatedUser', $personID);
$clientContactID and $comment->set_value('commentCreatedUserClientContactID', $clientContactID);
$comment->set_value("commentCreatedUserText", $email_receive->mail_headers["from"]);
$comment->set_value("commentEmailMessageID", $email_receive->mail_headers["message-id"]);
$comment->updateSearchIndexLater = true;
$comment->skip_modified_fields = true;
$comment->save();
if ($email_receive->mimebits) {
comment::update_mime_parts($comment->get_id(), $email_receive->mimebits);
}
// CYBER-ONLY: Re-open task, if comment has been made by an external party.
if (config::for_cyber() && !$comment->get_value('commentCreatedUser')) {
$e = $entity->get_parent_object();
if ($e->classname == "task" && substr($e->get_value("taskStatus"), 0, 4) != "open") {
$tmp = $current_user;
$current_user = new person();
$personID = $e->get_value("managerID") or $personID = $e->get_value("personID") or $personID = $e->get_value("creatorID");
$current_user->load_current_user($personID);
// fake identity
singleton("current_user", $current_user);
$e->set_value("taskStatus", "open_inprogress");
$e->save();
$current_user = $tmp;
}
}
return $comment;
}
示例2: mkdir
mkdir($dir, 0777);
}
// Write out all of the attachments and generated files to the local filesystem
foreach ((array) $files as $k => $f) {
$fullpath = $dir . DIRECTORY_SEPARATOR . $f["name"];
if ($f["blob"]) {
file_put_contents($fullpath, $f["blob"]);
} else {
if ($f["tmp_name"]) {
rename($f["tmp_name"], $fullpath);
}
}
$files[$k]["fullpath"] = $fullpath;
}
if ($files) {
comment::update_mime_parts($commentID, $files);
}
// Re-email the comment out, including any attachments
if (!comment::send_comment($commentID, $emailRecipients, false, $files)) {
alloc_error("Email failed to send.");
}
foreach ((array) $files as $k => $f) {
if (file_exists($f["fullpath"])) {
unlink($f["fullpath"]);
}
}
rmdir_if_empty($dir);
// Re-direct browser back home
$TPL["message_good"][] = $message_good;
$extra .= "&sbs_link=comments";
alloc_redirect($TPL["url_alloc_" . $_REQUEST["commentMaster"]] . $_REQUEST["commentMaster"] . "ID=" . $_REQUEST["commentMasterID"] . $extra);