| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | public function modifyPublished() |
||
| 21 | { |
||
| 22 | $this->onlyAdmin(); |
||
| 23 | if (!$this->container->getRequest()->isPost()) { |
||
| 24 | throw new \Core\JsonException('Call is not post'); |
||
| 25 | } |
||
| 26 | $state = (bool)($this->request->getData("state") === 'true'); |
||
| 27 | $postId = (int)$this->request->getData("postId"); |
||
| 28 | |||
| 29 | $result["success"] = $this->postModule->setPublished(!$state, $postId); |
||
|
|
|||
| 30 | $result["state"] = !$state; |
||
| 31 | $result["postId"] = $postId; |
||
| 32 | echo json_encode($result); |
||
| 33 | } |
||
| 49 | } |