3 if (!defined('GNUSOCIAL')) { exit(1); }
5 class IpregistrationsAction extends ManagedAction
7 protected $needLogin = true;
9 protected $ipaddress = null;
13 return sprintf(_('Registrations from IP %s'), $this->ipaddress);
16 protected function doPreparation()
18 if (!$this->scoped->hasRight(Right::SILENCEUSER) && !$this->scoped->hasRole(Profile_role::ADMINISTRATOR)) {
19 throw new AuthorizationException(_('You are not authorized to view this page.'));
22 $this->ipaddress = $this->trimmed('ipaddress');
23 $this->profile_ids = Registration_ip::usersByIP($this->ipaddress);
26 public function showContent()
28 $this->elementStart('ul');
29 $profile = Profile::multiGet('id', $this->profile_ids);
30 while ($profile->fetch()) {
31 $this->elementStart('li');
33 $this->element('a', ['href'=>$profile->getUrl()], $profile->getFancyName());
34 } catch (InvalidUrlException $e) {
35 $this->element('span', null, $profile->getFancyName());
37 $this->elementEnd('li');
39 $this->elementEnd('ul');