Show logged event IPs on user page

This commit is contained in:
Shish
2019-02-22 21:04:09 +00:00
parent 7abf1aa591
commit a8dfc9277b
2 changed files with 30 additions and 3 deletions

View File

@@ -240,7 +240,9 @@ class UserPage extends Extension {
$this->theme->display_ip_list(
$page,
$this->count_upload_ips($event->display_user),
$this->count_comment_ips($event->display_user));
$this->count_comment_ips($event->display_user),
$this->count_log_ips($event->display_user)
);
}
}
@@ -587,6 +589,21 @@ class UserPage extends Extension {
return $rows;
}
private function count_log_ips(User $duser): array {
if(!class_exists('LogDatabase')) return array();
global $database;
$rows = $database->get_pairs("
SELECT
address,
COUNT(id) AS count,
MAX(date_sent) AS most_recent
FROM score_log
WHERE username=:username
GROUP BY address
ORDER BY most_recent DESC", array("username"=>$duser->name));
return $rows;
}
private function delete_user(Page $page, bool $with_images=false, bool $with_comments=false) {
global $user, $config, $database;