Ejemplo n.º 1
0
 function get_one_comment_array($v = array(), $all_parties = array())
 {
     global $TPL;
     $current_user =& singleton("current_user");
     $new = $v;
     $token = new token();
     if ($token->select_token_by_entity_and_action("comment", $new["commentID"], "add_comment_from_email")) {
         if ($token->get_value("tokenHash")) {
             $new["hash"] = $token->get_value("tokenHash");
             $new["hashKey"] = "{Key:" . $new["hash"] . "}";
             $new["hashHTML"] = " <em class=\"faint\">" . $new["hashKey"] . "</em>";
         }
         $ip = interestedParty::get_interested_parties("comment", $new["commentID"]);
         foreach ((array) $ip as $email => $info) {
             $all_parties += $ip;
             if ($info["selected"]) {
                 $sel[] = $email;
             }
         }
         foreach ($all_parties as $email => $i) {
             in_array($email, (array) $sel) and $recipient_selected[] = $i["identifier"];
         }
         if (interestedParty::is_external("comment", $new["commentID"])) {
             $new["external"] = " loud";
             $label = "<em class='faint warn'>[ External Conversation ]</em>";
         } else {
             $label = "<em class='faint'>[ Internal Conversation ]</em>";
         }
         foreach ((array) $all_parties as $email => $info) {
             $recipient_ops[$info["identifier"]] = $info["name"] . " <" . $email . ">";
         }
         $new["recipient_editor"] = "<span class='nobr' style='width:100%;display:inline;' class='recipient_editor'>";
         $new["recipient_editor"] .= "<span class='noprint hidden' id='recipient_dropdown_" . $new["commentID"] . "'>\n                                    <form action='" . $TPL["url_alloc_updateRecipients"] . "' method='post'>\n                                      <select name='comment_recipients[]' multiple='true' data-callback='save_recipients'>\n                                      " . page::select_options($recipient_ops, $recipient_selected) . "\n                                      </select>\n                                      <input type='hidden' name='commentID' value='" . $new["commentID"] . "'>\n                                      <input type='submit' value='Go' style='display:none'>\n                                    </form>\n                                  </span>";
         $new["recipient_editor"] .= "<a class='magic recipient_editor_link' id='r_e_" . $new["commentID"] . "' style='text-decoration:none' href='#x'>" . $label . "</a>";
         $new["recipient_editor"] .= "</span>";
         $new["reply"] = '<a href="" class="noprint commentreply">reply</a>';
     }
     if ($v["timeSheetID"]) {
         $timeSheet = new timeSheet();
         $timeSheet->set_id($v["timeSheetID"]);
         $v["ts_label"] = " (Time Sheet #" . $timeSheet->get_id() . ")";
     }
     $new["attribution"] = comment::get_comment_attribution($v);
     $new["commentCreatedUserEmail"] = comment::get_comment_author_email($v);
     $s = commentTemplate::populate_string(config::get_config_item("emailSubject_taskComment"), $entity, $id);
     $new["commentEmailSubject"] = $s . " " . $new["hashKey"];
     if (!$_GET["commentID"] || $_GET["commentID"] != $v["commentID"]) {
         if ($options["showEditButtons"] && $new["comment_buttons"]) {
             $new["form"] = '<form action="' . $TPL["url_alloc_comment"] . '" method="post">';
             $new["form"] .= '<input type="hidden" name="entity" value="' . $v["commentType"] . '">';
             $new["form"] .= '<input type="hidden" name="entityID" value="' . $v["commentLinkID"] . '">';
             $new["form"] .= '<input type="hidden" name="commentID" value="' . $v["commentID"] . '">';
             $new["form"] .= '<input type="hidden" name="comment_id" value="' . $v["commentID"] . '">';
             $new["form"] .= $new["comment_buttons"];
             $new["form"] .= '<input type="hidden" name="sessID" value="' . $TPL["sessID"] . '">';
             $new["form"] .= '</form>';
         }
         $v["commentMimeParts"] and $files = unserialize($v["commentMimeParts"]);
         if (is_array($files)) {
             foreach ($files as $file) {
                 $new["files"] .= '<div align="center" style="float:left; display:inline; margin-right:14px;">';
                 $new["files"] .= "<a href=\"" . $TPL["url_alloc_getMimePart"] . "part=" . $file["part"] . "&entity=comment&id=" . $v["commentID"] . "\">";
                 $new["files"] .= get_file_type_image($file["name"]) . "<br>" . page::htmlentities($file["name"]);
                 $new["files"] .= " (" . get_size_label($file["size"]) . ")</a>";
                 $new["files"] .= '</div>';
             }
         }
         $v["commentEmailRecipients"] and $new["emailed"] = 'Emailed to ' . page::htmlentities($v["commentEmailRecipients"]);
     }
     return (array) $new;
 }
Ejemplo n.º 2
0
function get_filesize_label($file)
{
    $size = filesize($file);
    return get_size_label($size);
}