WebOrbiton
v2.0.0.1

Publisium

28 lines · 699 B
  1. <?php
  2. ​
  3. declare(strict_types=1);
  4. ​
  5. require_once __DIR__ . '/includes/config.php';
  6. require_once __DIR__ . '/includes/database.php';
  7. require_once __DIR__ . '/includes/user-auth.php';
  8. require_once __DIR__ . '/includes/site-comments.php';
  9. ​
  10. UserAuth::boot();
  11. ​
  12. if (($_SERVER['REQUEST_METHOD'] ?? '') !== 'POST') {
  13. header('Allow: POST');
  14. http_response_code(405);
  15. exit;
  16. }
  17. ​
  18. SiteComments::handleSubmission($_POST);
  19. ​
  20. $returnTo = (string) ($_POST['return_to'] ?? '');
  21. if (preg_match('#^/(?![/\\\\])[^\s]*$#', $returnTo) !== 1) {
  22. $returnTo = SiteFront::homeUrl('');
  23. }
  24. $returnTo = (string) preg_replace('/#.*$/', '', $returnTo);
  25. ​
  26. header('Location: ' . $returnTo . '#comment-form', true, 303);
  27. exit;
  28. ​