@@ 31-48 (lines=18) @@ | ||
28 | * @param HTTPRequest $request |
|
29 | * @return HTTPResponse |
|
30 | */ |
|
31 | public function spam(HTTPRequest $request) |
|
32 | { |
|
33 | $ids = array(); |
|
34 | ||
35 | foreach ($this->getRecords() as $record) { |
|
36 | array_push($ids, $record->ID); |
|
37 | $record->markSpam(); |
|
38 | } |
|
39 | ||
40 | $response = new HTTPResponse(Convert::raw2json(array( |
|
41 | 'done' => true, |
|
42 | 'records' => $ids |
|
43 | ))); |
|
44 | ||
45 | $response->addHeader('Content-Type', 'text/json'); |
|
46 | ||
47 | return $response; |
|
48 | } |
|
49 | ||
50 | /** |
|
51 | * @param HTTPRequest $request |
|
@@ 54-71 (lines=18) @@ | ||
51 | * @param HTTPRequest $request |
|
52 | * @return HTTPResponse |
|
53 | */ |
|
54 | public function approve(HTTPRequest $request) |
|
55 | { |
|
56 | $ids = array(); |
|
57 | ||
58 | foreach ($this->getRecords() as $record) { |
|
59 | array_push($ids, $record->ID); |
|
60 | $record->markApproved(); |
|
61 | } |
|
62 | ||
63 | $response = new HTTPResponse(Convert::raw2json(array( |
|
64 | 'done' => true, |
|
65 | 'records' => $ids |
|
66 | ))); |
|
67 | ||
68 | $response->addHeader('Content-Type', 'text/json'); |
|
69 | ||
70 | return $response; |
|
71 | } |
|
72 | } |
|
73 |