src/snac/server/ServerExecutor.php
/**
     * Send Feedback
     *
     * Sends the given message as feedback to the correct user to handle feedback. It also
     * emails the user to notify them of the feedback.
     *
     * @param string[] $input Input array from the Server object
     * @throws \snac\exceptions\SNACInputException
     * @return string[] The response to send to the client
     */
Send Feedback
Sends the given message as feedback to the correct user to handle feedback. It also
emails the user to notify them of the feedback.

@param string[] $input Input array from the Server object
@throws \snac\exceptions\SNACInputException
@return string[] The response to send to the client
Send Feedback Sends the given message as feedback to the correct user to handle feedback . It also emails the user to notify them of the feedback . @param string [] $input Input array from the Server object @throws \ snac \ exceptions \ SNACInputException @return string [] The response to send to the client
public function sendFeedback(&$input) {
        if (!isset($input["message"])) {
            throw new \snac\exceptions\SNACInputException("No feedback message given to send", 400);
        }
        $response = array("result" => "failure");
        $message = new \snac\data\Message($input["message"]);
        $this->logger->addDebug("Message received", $message->toArray());
        if ($message->getFromUser() === null && $message->getFromString() === null) {
            throw new \snac\exceptions\SNACPermissionException("Feedback can't be sent completely anonymously.", 403);
        } else if ($message->getFromUser() !== null && $this->user !== null && $message->getFromUser()->getUserID() !== $this->user->getUserID()) {
            throw new \snac\exceptions\SNACPermissionException("User does not have permission to send feedback as another user.", 403);
        } else if ($message->getFromUser() === null && $this->user !== null) {
            throw new \snac\exceptions\SNACPermissionException("Feedback can't be anonymous if the user is logged in.", 403);
        } else if ($message->getFromUser() !== null && $this->user === null) {
            throw new \snac\exceptions\SNACPermissionException("Feedback can't be sent from a user if they are not logged in.", 403);
        }
        if (isset(\snac\Config::$FEEDBACK_OSTICKET_ONLY) && \snac\Config::$FEEDBACK_OSTICKET_ONLY) {
            $osticket = new \snac\server\support\OSTicket();
            $osticket->submitMessageAsTicket($message);
            $response["result"] = "success";
        } else if (isset(\snac\Config::$FEEDBACK_RECIPIENTS) && is_array(\snac\Config::$FEEDBACK_RECIPIENTS)) {
            foreach (\snac\Config::$FEEDBACK_RECIPIENTS as $recipient) {
                $tmpUser = new \snac\data\User();
                $tmpUser->setUserName($recipient);
                $tmpUser->setEmail($recipient);
                $tmpUser->setFullName($recipient);
                if (!\snac\Config::$FEEDBACK_EMAIL_ONLY) {
                    $toUser = $this->uStore->readUser($tmpUser);
                    if ($toUser === false) {
                        throw new \snac\exceptions\SNACUserException("Recipient User does not exist.", 400);
                    }
                    $message->setToUser($toUser);
                    $this->uStore->writeMessage($message);
                } else {
                    $message->setToUser($tmpUser);
                }
                $this->mailer->sendUserMessage($message);
            }
            $response["result"] = "success";
        }
        return $response;
    }
public function sendFeedback ( & $ input ) { if ( ! isset ( $ input [ " message " ] ) ) { throw new \ snac \ exceptions \ SNACInputException ( " No feedback message given to send " , 400 ) ; } $ response = array ( " result " => " failure " ) ; $ message = new \ snac \ data \ Message ( $ input [ " message " ] ) ; $ this -> logger -> addDebug ( " Message received " , $ message -> toArray ( ) ) ; if ( $ message -> getFromUser ( ) === null && $ message -> getFromString ( ) === null ) { throw new \ snac \ exceptions \ SNACPermissionException ( " Feedback can't be sent completely anonymously. " , 403 ) ; } else if ( $ message -> getFromUser ( ) !== null && $ this -> user !== null && $ message -> getFromUser ( ) -> getUserID ( ) !== $ this -> user -> getUserID ( ) ) { throw new \ snac \ exceptions \ SNACPermissionException ( " User does not have permission to send feedback as another user. " , 403 ) ; } else if ( $ message -> getFromUser ( ) === null && $ this -> user !== null ) { throw new \ snac \ exceptions \ SNACPermissionException ( " Feedback can't be anonymous if the user is logged in. " , 403 ) ; } else if ( $ message -> getFromUser ( ) !== null && $ this -> user === null ) { throw new \ snac \ exceptions \ SNACPermissionException ( " Feedback can't be sent from a user if they are not logged in. " , 403 ) ; } if ( isset ( \ snac \ Config :: $ FEEDBACK_OSTICKET_ONLY ) && \ snac \ Config :: $ FEEDBACK_OSTICKET_ONLY ) { $ osticket = new \ snac \ server \ support \ OSTicket ( ) ; $ osticket -> submitMessageAsTicket ( $ message ) ; $ response [ " result " ] = " success " ; } else if ( isset ( \ snac \ Config :: $ FEEDBACK_RECIPIENTS ) && is_array ( \ snac \ Config :: $ FEEDBACK_RECIPIENTS ) ) { foreach ( \ snac \ Config :: $ FEEDBACK_RECIPIENTS as $ recipient ) { $ tmpUser = new \ snac \ data \ User ( ) ; $ tmpUser -> setUserName ( $ recipient ) ; $ tmpUser -> setEmail ( $ recipient ) ; $ tmpUser -> setFullName ( $ recipient ) ; if ( ! \ snac \ Config :: $ FEEDBACK_EMAIL_ONLY ) { $ toUser = $ this -> uStore -> readUser ( $ tmpUser ) ; if ( $ toUser === false ) { throw new \ snac \ exceptions \ SNACUserException ( " Recipient User does not exist. " , 400 ) ; } $ message -> setToUser ( $ toUser ) ; $ this -> uStore -> writeMessage ( $ message ) ; } else { $ message -> setToUser ( $ tmpUser ) ; } $ this -> mailer -> sendUserMessage ( $ message ) ; } $ response [ " result " ] = " success " ; } return $ response ; }
Send Feedback
 Sends the given message as feedback to the correct user to handle feedback.
Send Feedback Sends the given message as feedback to the correct user to handle feedback .
// Only send to OS Ticket // Send the message through the system // Send the message via email