src/snac/client/webui/WebUIExecutor.php
/**
     * Send a Feedback Message
     *
     * Sends the feedback given in the input to the server's feedback mechanism.  If no
     * user information is given, it will send the user's IP address for verification.
     *
     * @param string[] $input Post/Get inputs from the webui
     * @return string The response to the client
     */
Send a Feedback Message
Sends the feedback given in the input to the server's feedback mechanism.  If no
user information is given, it will send the user's IP address for verification.

@param string[] $input Post/Get inputs from the webui
@return string The response to the client
Send a Feedback Message Sends the feedback given in the input to the server ' s feedback mechanism . If no user information is given it will send the user ' s IP address for verification . @param string [] $input Post / Get inputs from the webui @return string The response to the client
public function sendFeedbackMessage(&$input) {
        $response = array();
        if (isset($input["subject"]) && isset($input["body"]) && isset($input["token"])) {
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, "https://www.google.com/recaptcha/api/siteverify");
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
            curl_setopt($ch, CURLOPT_POSTFIELDS, array(
                "secret" => "6LdjGCwUAAAAAMRzQh-sVk9DF7ST9oVBGLDIogHv",
                "response" => $input["token"]
            ));
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            $verifyResponse = curl_exec($ch);
            curl_close($ch);
            $verified = array ("success" => false);
            if ($verifyResponse != null) {
                $verified = json_decode($verifyResponse, true);
            }
            if (isset($verified["success"]) && $verified["success"] === true) {
                $message = new \snac\data\Message();
                $message->setSubject($input["subject"]);
                $message->setBody($input["body"]);
                if ($this->getUser() !== null) {
                    $message->setFromUser($this->getUser());
                } else {
                    if (isset($input["email"]) && isset($input["name"])) {
                        $message->setFromString($input["name"] . "|" . $input["email"]);
                    } else {
                        $message->setFromString("Unknown User|anonymous_user@".$_SERVER['REMOTE_ADDR']);
                    }
                }
                if (isset($input["screenshot"])) {
                    $message->setAttachmentContent($input["screenshot"]);
                    $message->setAttachmentFilename("screenshot.png");
                }
                $ask = array("command"=>"send_feedback",
                            "message"=>$message->toArray());
                $serverResponse = $this->connect->query($ask);
                if (!isset($serverResponse["result"]) || $serverResponse["result"] != 'success') {
                    $response["result"] = "error";
                }
                $response["result"] = "success";
            } else {
                $response["result"] = "error";
                $this->logger->addWarning("Failed feedback attempt", array_merge($input, $verified));
            }
        } else {
            $response["result"] = "error";
        }
        return $response;
    }
public function sendFeedbackMessage ( & $ input ) { $ response = array ( ) ; if ( isset ( $ input [ " subject " ] ) && isset ( $ input [ " body " ] ) && isset ( $ input [ " token " ] ) ) { $ ch = curl_init ( ) ; curl_setopt ( $ ch , CURLOPT_URL , " https://www.google.com/recaptcha/api/siteverify " ) ; curl_setopt ( $ ch , CURLOPT_CUSTOMREQUEST , 'POST' ) ; curl_setopt ( $ ch , CURLOPT_POSTFIELDS , array ( " secret " => " 6LdjGCwUAAAAAMRzQh-sVk9DF7ST9oVBGLDIogHv " , " response " => $ input [ " token " ] ) ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , true ) ; $ verifyResponse = curl_exec ( $ ch ) ; curl_close ( $ ch ) ; $ verified = array ( " success " => false ) ; if ( $ verifyResponse != null ) { $ verified = json_decode ( $ verifyResponse , true ) ; } if ( isset ( $ verified [ " success " ] ) && $ verified [ " success " ] === true ) { $ message = new \ snac \ data \ Message ( ) ; $ message -> setSubject ( $ input [ " subject " ] ) ; $ message -> setBody ( $ input [ " body " ] ) ; if ( $ this -> getUser ( ) !== null ) { $ message -> setFromUser ( $ this -> getUser ( ) ) ; } else { if ( isset ( $ input [ " email " ] ) && isset ( $ input [ " name " ] ) ) { $ message -> setFromString ( $ input [ " name " ] . " | " . $ input [ " email " ] ) ; } else { $ message -> setFromString ( " Unknown User|anonymous_user@ " . $ _SERVER [ 'REMOTE_ADDR' ] ) ; } } if ( isset ( $ input [ " screenshot " ] ) ) { $ message -> setAttachmentContent ( $ input [ " screenshot " ] ) ; $ message -> setAttachmentFilename ( " screenshot.png " ) ; } $ ask = array ( " command " => " send_feedback " , " message " => $ message -> toArray ( ) ) ; $ serverResponse = $ this -> connect -> query ( $ ask ) ; if ( ! isset ( $ serverResponse [ " result " ] ) || $ serverResponse [ " result " ] != 'success' ) { $ response [ " result " ] = " error " ; } $ response [ " result " ] = " success " ; } else { $ response [ " result " ] = " error " ; $ this -> logger -> addWarning ( " Failed feedback attempt " , array_merge ( $ input , $ verified ) ) ; } } else { $ response [ " result " ] = " error " ; } return $ response ; }
Send a Feedback Message
 Sends the feedback given in the input to the server's feedback mechanism.
Send a Feedback Message Sends the feedback given in the input to the server ' s feedback mechanism .
// confirm the token first // split out the users to send to // set this message from the IP address: