public static function requiresApproval($user) { if (!empty($_SESSION['terms_approved'])) { return false; } global $user; if (!$user) { // Anonymous users cannot approve a thing. return false; } $lib = new self(); $page = $lib->getApprovalPageInfo(); if (!$page) { return false; } $perms = Perms::get('wiki page', $page['pageName']); if ($perms->wiki_approve) { // Users who can approve the terms do not need to approve them // This includes adminsitrators who have all permissions // Among other things, this avoids the issue of having to approve terms // after modifying the page $_SESSION['terms_approved'] = 'none'; return false; } $hash = $lib->generateHash($page, $user); $versions = $lib->getApprovedVersions($user); if (in_array($hash, $versions)) { $_SESSION['terms_approved'] = $hash; return false; } return true; }