aboutsummaryrefslogtreecommitdiff
path: root/mod/logbrowser/views/default
diff options
context:
space:
mode:
authorBrett Profitt <brett.profitt@gmail.com>2012-01-20 18:43:34 -0800
committerBrett Profitt <brett.profitt@gmail.com>2012-01-20 18:43:34 -0800
commit12c4a61edc0a225677c31f6d26a7a785c065c115 (patch)
treea17ceb5171ce8225f25fcb6299dd6739f9e47365 /mod/logbrowser/views/default
parent9cca28b590a5884033c60af5a47aa3dcc383f7f0 (diff)
downloadelgg-12c4a61edc0a225677c31f6d26a7a785c065c115.tar.gz
elgg-12c4a61edc0a225677c31f6d26a7a785c065c115.tar.bz2
Fixes #2222. Added IP address to system log table and log browser. Fixed problem in log browser that would only show entries without an owner_guid.
Diffstat (limited to 'mod/logbrowser/views/default')
-rw-r--r--mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php13
-rw-r--r--mod/logbrowser/views/default/forms/logbrowser/refine.php11
-rw-r--r--mod/logbrowser/views/default/logbrowser/table.php10
3 files changed, 28 insertions, 6 deletions
diff --git a/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php b/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php
index a04ef686a..89894e3d2 100644
--- a/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php
+++ b/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php
@@ -12,11 +12,12 @@ $offset = get_input('offset');
$search_username = get_input('search_username');
if ($search_username) {
- if ($user = get_user_by_username($search_username)) {
+ $user = get_user_by_username($search_username);
+ if ($user) {
$user_guid = $user->guid;
}
} else {
- $user_guid = get_input('user_guid',0);
+ $user_guid = get_input('user_guid', null);
if ($user_guid) {
$user_guid = (int) $user_guid;
} else {
@@ -34,6 +35,8 @@ if ($timeupper) {
$timeupper = strtotime($timeupper);
}
+$ip_address = get_input('ip_address');
+
$refine = elgg_view('logbrowser/refine', array(
'user_guid' => $user_guid,
'timeupper' => $timeupper,
@@ -41,8 +44,10 @@ $refine = elgg_view('logbrowser/refine', array(
));
// Get log entries
-$log = get_system_log($user_guid, "", "", "","", $limit, $offset, false, $timeupper, $timelower);
-$count = get_system_log($user_guid, "", "", "","", $limit, $offset, true, $timeupper, $timelower);
+$log = get_system_log($user_guid, "", "", "","", $limit, $offset, false, $timeupper, $timelower,
+ 0, $ip_address);
+$count = get_system_log($user_guid, "", "", "","", $limit, $offset, true, $timeupper, $timelower,
+ 0, $ip_address);
$table = elgg_view('logbrowser/table', array('log_entries' => $log));
diff --git a/mod/logbrowser/views/default/forms/logbrowser/refine.php b/mod/logbrowser/views/default/forms/logbrowser/refine.php
index ff3f48b03..6ec5907b6 100644
--- a/mod/logbrowser/views/default/forms/logbrowser/refine.php
+++ b/mod/logbrowser/views/default/forms/logbrowser/refine.php
@@ -19,13 +19,14 @@ if (isset($vars['timeupper'])) {
$upperval = "";
}
if (isset($vars['user_guid'])) {
- if ($user = get_entity($vars['user_guid'])) {
+ $user = get_entity($vars['user_guid']);
+ if ($user) {
$userval = $user->username;
}
} else {
$userval = "";
}
-
+$ip_address = elgg_extract('ip_address', '');
$form = "<div>" . elgg_echo('logbrowser:user');
$form .= elgg_view('input/text', array(
@@ -33,6 +34,12 @@ $form .= elgg_view('input/text', array(
'value' => $userval,
)) . "</div>";
+$form .= "<div>" . elgg_echo('logbrowser:ip_address');
+$form .= elgg_view('input/text', array(
+ 'name' => 'ip_address',
+ 'value' => $ip_address,
+)) . "</div>";
+
$form .= "<div>" . elgg_echo('logbrowser:starttime');
$form .= elgg_view('input/text', array(
'name' => 'timelower',
diff --git a/mod/logbrowser/views/default/logbrowser/table.php b/mod/logbrowser/views/default/logbrowser/table.php
index b7f6a1f20..9a867e080 100644
--- a/mod/logbrowser/views/default/logbrowser/table.php
+++ b/mod/logbrowser/views/default/logbrowser/table.php
@@ -11,6 +11,7 @@ $log_entries = $vars['log_entries'];
<table class="elgg-table">
<tr>
<th><?php echo elgg_echo('logbrowser:date'); ?></th>
+ <th><?php echo elgg_echo('logbrowser:ip_address'); ?></th>
<th><?php echo elgg_echo('logbrowser:user:name'); ?></th>
<th><?php echo elgg_echo('logbrowser:user:guid'); ?></th>
<th><?php echo elgg_echo('logbrowser:object'); ?></th>
@@ -20,6 +21,12 @@ $log_entries = $vars['log_entries'];
<?php
$alt = '';
foreach ($log_entries as $entry) {
+ if ($entry->ip_address) {
+ $ip_address = $entry->ip_address;
+ } else {
+ $ip_address = '&nbsp;';
+ }
+
$user = get_entity($entry->performed_by_guid);
if ($user) {
$user_link = elgg_view('output/url', array(
@@ -51,6 +58,9 @@ $log_entries = $vars['log_entries'];
<td class="log-entry-time">
<?php echo date('r', $entry->time_created); ?>
</td>
+ <td class="log-entry-ip-address">
+ <?php echo $ip_address; ?>
+ </td>
<td class="log-entry-user">
<?php echo $user_link; ?>
</td>