Elgg  Version 4.3
Go to the documentation of this file.
1 <?php
3 namespace Elgg\Router\Middleware;
6 use Elgg\Request;
25  public function __invoke(Request $request): void {
26  if ($this->validateInviteCode($request)) {
27  return;
28  }
31  }
42  protected function validateInviteCode(Request $request): bool {
43  $friend_guid = (int) $request->getParam('friend_guid');
44  $invitecode = $request->getParam('invitecode');
46  if (empty($friend_guid) || empty($invitecode)) {
47  return false;
48  }
50  $friend = get_user($friend_guid);
51  if (!$friend instanceof \ElggUser) {
52  return false;
53  }
55  if (elgg_validate_invite_code($friend->username, $invitecode)) {
56  return true;
57  }
59  throw new RegistrationAllowedGatekeeperException(elgg_echo('RegistrationAllowedGatekeeperException:invalid_invitecode'));
60  }
68  protected function assertRegistrationEnabled(): void {
69  if (_elgg_services()->config->allow_registration) {
70  return;
71  }
74  }
75 }
Get a user object from a GUID.
Definition: users.php:20
validateInviteCode(Request $request)
Validate the optional invite code.
Definition: livesearch.php:11
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it plus any associated interface definition plus the scripts used to control compilation and installation of the executable as a special the source code distributed need not include anything that is normally and so on of the operating system on which the executable unless that component itself accompanies the executable If distribution of executable or object code is made by offering access to copy from a designated then offering equivalent access to copy the source code from the same place counts as distribution of the source even though third parties are not compelled to copy the source along with the object code You may not or distribute the Program except as expressly provided under this License Any attempt otherwise to sublicense or distribute the Program is void
Definition: LICENSE.txt:215
__invoke(Request $request)
Validate input and/or settings to allow access to registration resources.
getParam($key, $default=null, $filter=true)
Get an element of the params array.
Definition: Request.php:79
elgg_echo($message_key, array $args=[], $language="")
Elgg language module Functions to manage language and translations.
Definition: languages.php:18
Assembles and outputs the registration page.
Definition: register.php:12
Validate if registration is allowed by the site configuration.
Validate that registration is allowed based on one of the following:
Definition: register.php:13
Request container.
Definition: Request.php:12
Get the global service provider.
Definition: elgglib.php:638
elgg_validate_invite_code($username, $code)
Validate a user&#39;s invite code.
Definition: users.php:155