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); }