create() public method

public create ( $postdata )
Beispiel #1
0
     $loginAttempts = new LoginAttempts($db, $user);
     httpResponse($loginAttempts->delete((int) $params[1]));
     break;
 case validateRoute('GET', 'signups'):
     $signups = new Signups($db, $user);
     list($result, $totalCount) = $signups->query((int) $_GET["limit"], (int) $_GET["index"]);
     httpResponse($result, $totalCount);
     break;
 case validateRoute('GET', 'ipchanges'):
     $ipchanges = new IpChanges($db, $user);
     list($result, $totalCount) = $ipchanges->query((int) $_GET["limit"], (int) $_GET["index"]);
     httpResponse($result, $totalCount);
     break;
 case validateRoute('POST', 'reports'):
     $reports = new Reports($db, $user);
     httpResponse($reports->create($postdata));
     break;
 case validateRoute('GET', 'reports'):
     $mailbox = new Mailbox($db, $user);
     $torrent = new Torrent($db, $user);
     $subtitles = new Subtitles($db, $user);
     $requests = new Requests($db, $user);
     $forum = new Forum($db, $user);
     $log = new Logs($db);
     $comments = new Comments($db, $user);
     $reports = new Reports($db, $user, $torrent, $subtitles, $requests, $forum, $mailbox, $comments, $log);
     list($result, $totalCount) = $reports->query(array("limit" => $_GET["limit"], "index" => $_GET["index"]));
     httpResponse($result, $totalCount);
     break;
 case validateRoute('PATCH', 'reports/\\d+'):
     $reports = new Reports($db, $user);
Beispiel #2
0
 /**
  * Create report from REST request and get response.
  *
  * @access public
  *
  * @param WP_REST_Request $request Current request.
  * @return WP_REST_Response $response Response for /reports endpoint.
  */
 public function report(\WP_REST_Request $request)
 {
     Reports::create($request->get_body_params());
     return self::reports($request);
 }