function Grid() { $db =& $this->db; $response = new ResponseManager(); $type = Kit::GetParam('filter_type', _POST, _WORD); $fromDt = Kit::GetParam('filter_fromdt', _POST, _STRING); setSession('sessions', 'Filter', Kit::GetParam('XiboFilterPinned', _REQUEST, _CHECKBOX, 'off')); setSession('sessions', 'filter_type', $type); setSession('sessions', 'filter_fromdt', $fromDt); $SQL = "SELECT session.userID, user.UserName, IsExpired, LastPage, session.LastAccessed, RemoteAddr, UserAgent "; $SQL .= "FROM `session` LEFT OUTER JOIN user ON user.userID = session.userID "; $SQL .= "WHERE 1 = 1 "; if ($fromDt != '') { // From Date is the Calendar Formatted DateTime in ISO format $SQL .= sprintf(" AND session.LastAccessed < '%s' ", DateManager::getMidnightSystemDate(DateManager::getTimestampFromString($fromDt))); } if ($type == "active") { $SQL .= " AND IsExpired = 0 "; } if ($type == "expired") { $SQL .= " AND IsExpired = 1 "; } if ($type == "guest") { $SQL .= " AND session.userID IS NULL "; } // Load results into an array $log = $db->GetArray($SQL); Debug::LogEntry('audit', $SQL); if (!is_array($log)) { trigger_error($db->error()); trigger_error(__('Error getting the log'), E_USER_ERROR); } $cols = array(array('name' => 'lastaccessed', 'title' => __('Last Accessed')), array('name' => 'isexpired', 'title' => __('Active'), 'icons' => true), array('name' => 'username', 'title' => __('User Name')), array('name' => 'lastpage', 'title' => __('Last Page')), array('name' => 'ip', 'title' => __('IP Address')), array('name' => 'browser', 'title' => __('Browser'))); Theme::Set('table_cols', $cols); $rows = array(); foreach ($log as $row) { $row['userid'] = Kit::ValidateParam($row['userID'], _INT); $row['username'] = Kit::ValidateParam($row['UserName'], _STRING); $row['isexpired'] = Kit::ValidateParam($row['IsExpired'], _INT) == 1 ? 0 : 1; $row['lastpage'] = Kit::ValidateParam($row['LastPage'], _STRING); $row['lastaccessed'] = DateManager::getLocalDate(strtotime(Kit::ValidateParam($row['LastAccessed'], _STRING))); $row['ip'] = Kit::ValidateParam($row['RemoteAddr'], _STRING); $row['browser'] = Kit::ValidateParam($row['UserAgent'], _STRING); // Edit $row['buttons'][] = array('id' => 'sessions_button_logout', 'url' => 'index.php?p=sessions&q=ConfirmLogout&userid=' . $row['userid'], 'text' => __('Logout')); $rows[] = $row; } Theme::Set('table_rows', $rows); $response->SetGridResponse(Theme::RenderReturn('table_render')); $response->Respond(); }