Example #1
0
 private function report_feedback_action($request, $user)
 {
     $id = $request->variable('id', 0);
     $user_id = (int) $user->data['user_id'];
     // check that this is ajax request and that the user reporting the feedback is the recipient of the feedback
     if ($request->is_ajax() && $user_id == $this->manager->getFeedbackRecipientID($id)) {
         $reason = $request->variable('reason', '');
         confirm_box(false, $user->lang['REPORT_DESC'], '', 'report_feedback_form.html', "trader/view-feedback/?action=report&id=" . $id);
         if (confirm_box(true)) {
             //             REPORT the feedback
             $this->manager->report_feedback($id, $reason);
             if ($request->is_ajax()) {
                 $json_response = new \phpbb\json_response();
                 $json_response->send(array('MESSAGE_TITLE' => $user->lang['INFORMATION'], 'MESSAGE_TEXT' => $user->lang['REPORT_SUCCESS'], 'REFRESH_DATA' => array('time' => 3)));
             }
         }
     } else {
         // redirect to previous page if report is cancelled, or front page if no referrer
         redirect($request->header('referer', './index.php'));
     }
 }