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