2016-02-13 09:02:18 +09:00
|
|
|
<?php
|
|
|
|
|
|
|
|
if (!defined('GNUSOCIAL')) { exit(1); }
|
|
|
|
|
|
|
|
class IpregistrationsAction extends ManagedAction
|
|
|
|
{
|
|
|
|
protected $needLogin = true;
|
|
|
|
|
|
|
|
protected $ipaddress = null;
|
|
|
|
|
|
|
|
function title()
|
|
|
|
{
|
|
|
|
return sprintf(_('Registrations from IP %s'), $this->ipaddress);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function doPreparation()
|
|
|
|
{
|
2016-02-13 09:16:34 +09:00
|
|
|
if (!$this->scoped->hasRight(Right::SILENCEUSER) && !$this->scoped->hasRole(Profile_role::ADMINISTRATOR)) {
|
2016-02-13 09:10:01 +09:00
|
|
|
throw new AuthorizationException(_('You are not authorized to view this page.'));
|
2016-02-13 09:02:18 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
$this->ipaddress = $this->trimmed('ipaddress');
|
|
|
|
$this->profile_ids = Registration_ip::usersByIP($this->ipaddress);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function showContent()
|
|
|
|
{
|
|
|
|
$this->elementStart('ul');
|
2016-02-13 09:19:47 +09:00
|
|
|
$profile = Profile::multiGet('id', $this->profile_ids);
|
|
|
|
while ($profile->fetch()) {
|
2016-02-13 09:02:18 +09:00
|
|
|
$this->elementStart('li');
|
|
|
|
try {
|
|
|
|
$this->element('a', ['href'=>$profile->getUrl()], $profile->getFancyName());
|
|
|
|
} catch (InvalidUrlException $e) {
|
|
|
|
$this->element('span', null, $profile->getFancyName());
|
|
|
|
}
|
|
|
|
$this->elementEnd('li');
|
|
|
|
}
|
|
|
|
$this->elementEnd('ul');
|
|
|
|
}
|
|
|
|
}
|