Example #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;
 }
Example #2
0
<?php

/*
 * Copyright (C) 2006-2011 Alex Lance, Clancy Malcolm, Cyber IT Solutions
 * Pty. Ltd.
 * 
 * This file is part of the allocPSA application <*****@*****.**>.
 * 
 * allocPSA is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or (at
 * your option) any later version.
 * 
 * allocPSA is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
 * License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with allocPSA. If not, see <http://www.gnu.org/licenses/>.
*/
define("NO_REDIRECT", 1);
require_once "../alloc.php";
interestedParty::make_interested_parties('comment', $_POST['commentID'], $_POST['comment_recipients']);
if (interestedParty::is_external('comment', $_POST['commentID'])) {
    echo 'external';
} else {
    echo 'internal';
}