WebOrbiton
v2.0.0.1

Publisium

23 lines · 693 B
  1. <?php
  2. ​
  3. declare(strict_types=1);
  4. ​
  5. if (!AuthorProfile::isEnabled() || !Auth::canModerate()) {
  6. return ['Only editors can review author pages.', 'error', false];
  7. }
  8. ​
  9. $accountId = (int) ($_POST['account_id'] ?? 0);
  10. $decision = (string) ($_POST['decision'] ?? '');
  11. ​
  12. if ($accountId <= 0) {
  13. return ['We couldn’t find this author page.', 'error', false];
  14. }
  15. ​
  16. [$message, $type] = AuthorProfile::review($accountId, $_POST, $decision, (int) $currentUser['id'], (string) ($_POST['rejection_reason'] ?? ''));
  17. ​
  18. if ($type === 'success') {
  19. ActivityLog::record($decision === 'approve' ? 'profile.approve' : 'profile.reject', 'profile', $accountId);
  20. }
  21. ​
  22. return [$message, $type, $type === 'success'];
  23. ​