From 81ef3dc3564d645856721f0df93ab7ba751a0cae Mon Sep 17 00:00:00 2001 From: shish Date: Sun, 3 Jun 2007 10:40:00 +0000 Subject: [PATCH] List user's IPs git-svn-id: file:///home/shish/svn/shimmie2/trunk@152 7f39781d-f577-437e-ae19-be835c7a54ca --- core/ext/user.ext.php | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/core/ext/user.ext.php b/core/ext/user.ext.php index ee5ea4c1..6408cd45 100644 --- a/core/ext/user.ext.php +++ b/core/ext/user.ext.php @@ -302,6 +302,7 @@ class UserPage extends Extension { } if($user->is_admin()) { $page->add_main_block(new Block("More Options", $this->build_more_options($duser))); + $page->add_main_block(new Block("IP List", $this->build_ip_list($duser))); } } } @@ -378,6 +379,40 @@ class UserPage extends Extension { return $html; } + private function build_ip_list($duser) { + global $database; + global $config; + + $html = ""; + $html .= ""; + $html .= "
Uploaded from: "; + $rows = $database->db->GetAll(" + SELECT owner_ip, COUNT(images.id) AS count + FROM images + WHERE owner_id=? + GROUP BY owner_ip + ORDER BY posted DESC", array($duser->id), true); + foreach($rows as $row) { + $ip = $row['owner_ip']; + $count = $row['count']; + $html .= "
$ip ($count)"; + } + $html .= "
Commented from:"; + $rows = $database->db->GetAll(" + SELECT owner_ip, COUNT(comments.id) AS count + FROM comments + WHERE owner_id=? + GROUP BY owner_ip + ORDER BY posted DESC", array($duser->id), true); + foreach($rows as $row) { + $ip = $row['owner_ip']; + $count = $row['count']; + $html .= "
$ip ($count)"; + } + $html .= "
(Most recent at top)
"; + return $html; + } + private function build_links_block() { global $user;