Fix pagination isses in Active Sessions when a session is deleted. Fixes bug #11400
This commit is contained in:
parent
c3b554eed5
commit
c785474fb4
2 changed files with 25 additions and 29 deletions
|
|
@ -72,35 +72,30 @@ delete (kill) each one via www_killSession
|
|||
sub www_viewActiveSessions {
|
||||
my $session = shift;
|
||||
return $session->privilege->adminOnly unless canView($session);
|
||||
my ($output, $p, @row, $i, $sth, %data);
|
||||
tie %data, 'Tie::CPHash';
|
||||
$sth = $session->db->read("select users.username,users.userId,userSession.sessionId,userSession.expires,
|
||||
userSession.lastPageView,userSession.lastIP from users,userSession where users.userId=userSession.userId
|
||||
and users.userId<>1 order by users.username,userSession.lastPageView desc");
|
||||
while (%data = $sth->hash) {
|
||||
$row[$i] = '<tr class="tableData"><td>'.$data{username}.' ('.$data{userId}.')</td>';
|
||||
$row[$i] .= '<td>'.$data{sessionId}.'</td>';
|
||||
$row[$i] .= '<td>'.$session->datetime->epochToHuman($data{expires}).'</td>';
|
||||
$row[$i] .= '<td>'.$session->datetime->epochToHuman($data{lastPageView}).'</td>';
|
||||
$row[$i] .= '<td>'.$data{lastIP}.'</td>';
|
||||
$row[$i] .= '<td align="center">'.$session->icon->delete("op=killSession;sid=$data{sessionId}").'</td></tr>';
|
||||
$i++;
|
||||
}
|
||||
$sth->finish;
|
||||
$p = WebGUI::Paginator->new($session,$session->url->page('op=viewActiveSessions'));
|
||||
$p->setDataByArrayRef(\@row);
|
||||
my $i18n = WebGUI::International->new($session);
|
||||
$output .= '<table border="1" cellpadding="5" cellspacing="0" align="center">';
|
||||
$output .= '<tr class="tableHeader"><td>'.$i18n->get(428).'</td>';
|
||||
$output .= '<td>'.$i18n->get(435).'</td>';
|
||||
$output .= '<td>'.$i18n->get(432).'</td>';
|
||||
$output .= '<td>'.$i18n->get(430).'</td>';
|
||||
$output .= '<td>'.$i18n->get(431).'</td>';
|
||||
$output .= '<td>'.$i18n->get(436).'</td></tr>';
|
||||
$output .= $p->getPage($session->form->process("pn"));
|
||||
$output .= '</table>';
|
||||
$output .= $p->getBarTraditional($session->form->process("pn"));
|
||||
return WebGUI::AdminConsole->new($session,"activeSessions")->render($output);
|
||||
my $i18n = WebGUI::International->new($session);
|
||||
my $output = '<table border="1" cellpadding="5" cellspacing="0" align="center">';
|
||||
$output .= '<tr class="tableHeader"><td>'.$i18n->get(428).'</td>';
|
||||
$output .= '<td>'.$i18n->get(435).'</td>';
|
||||
$output .= '<td>'.$i18n->get(432).'</td>';
|
||||
$output .= '<td>'.$i18n->get(430).'</td>';
|
||||
$output .= '<td>'.$i18n->get(431).'</td>';
|
||||
$output .= '<td>'.$i18n->get(436).'</td></tr>';
|
||||
my $p = WebGUI::Paginator->new($session,$session->url->page('op=viewActiveSessions'));
|
||||
$p->setDataByQuery("select users.username,users.userId,userSession.sessionId,userSession.expires,
|
||||
userSession.lastPageView,userSession.lastIP from users,userSession where users.userId=userSession.userId
|
||||
and users.userId<>1 order by users.username,userSession.lastPageView desc");
|
||||
my $pn = $p->getPageNumber;
|
||||
foreach my $data (@{ $p->getPageData() }) {
|
||||
$output = '<tr class="tableData"><td>'.$data->{username}.' ('.$data->{userId}.')</td>';
|
||||
$output .= '<td>'.$data->{sessionId}.'</td>';
|
||||
$output .= '<td>'.$session->datetime->epochToHuman($data->{expires}).'</td>';
|
||||
$output .= '<td>'.$session->datetime->epochToHuman($data->{lastPageView}).'</td>';
|
||||
$output .= '<td>'.$data->{lastIP}.'</td>';
|
||||
$output .= '<td align="center">'.$session->icon->delete("op=killSession;sid=".$data->{sessionId}.";pn=$pn").'</td></tr>';
|
||||
}
|
||||
$output .= '</table>';
|
||||
$output .= $p->getBarTraditional();
|
||||
return WebGUI::AdminConsole->new($session,"activeSessions")->render($output);
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue