WebOrbiton
v1.0.0.1

StocketBase

24 lines · 408 B
  1. <?php
  2. ​
  3. declare(strict_types=1);
  4. ​
  5. if (count(get_included_files()) === 1) {
  6. http_response_code(403);
  7. exit;
  8. }
  9. ​
  10. if (!Auth::hasRoleAtLeast(Auth::ROLE_STORE_MANAGER)) {
  11. return;
  12. }
  13. ​
  14. $db = Database::site();
  15. ​
  16. $pageId = (int) ($_POST['page_id'] ?? 0);
  17. ​
  18. if ($pageId <= 0) {
  19. return;
  20. }
  21. ​
  22. $statement = $db->prepare('DELETE FROM pages WHERE id = :id AND is_home = 0');
  23. $statement->execute(['id' => $pageId]);
  24. ​