Skip to content

Commit

Permalink
Merge pull request #5125 from zero-24/patch-6
Browse files Browse the repository at this point in the history
[CS] CS for mod_whoisonline helper file
  • Loading branch information
infograf768 committed Nov 25, 2014
2 parents 121e645 + 461ad92 commit c7cdcbe
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions modules/mod_whosonline/helper.php
Expand Up @@ -12,9 +12,7 @@
/**
* Helper for mod_whosonline
*
* @package Joomla.Site
* @subpackage mod_whosonline
* @since 1.5
* @since 1.5
*/
class ModWhosonlineHelper
{
Expand All @@ -23,21 +21,23 @@ class ModWhosonlineHelper
*
* @return array The number of Users and Guests online.
*
* @since 1.5.0
* @since 1.5
**/
public static function getOnlineCount()
{
$db = JFactory::getDbo();
$db = JFactory::getDbo();

// Calculate number of guests and users
$result = array();
$result = array();
$user_array = 0;
$guest_array = 0;
$query = $db->getQuery(true)

$query = $db->getQuery(true)
->select('guest, client_id')
->from('#__session')
->where('client_id = 0');
$db->setQuery($query);

$sessions = (array) $db->loadObjectList();

if (count($sessions))
Expand Down Expand Up @@ -71,17 +71,18 @@ public static function getOnlineCount()
*
* @return array (array) $db->loadObjectList() The names of the online users.
*
* @since 1.5.0
* @since 1.5
**/
public static function getOnlineUserNames($params)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName(array('a.username', 'a.time', 'a.userid', 'a.client_id')))
->from('#__session AS a')
->where($db->quoteName('a.userid') . ' != 0')
->where($db->quoteName('a.client_id') . ' = 0')
->group($db->quoteName(array('a.username', 'a.time', 'a.userid', 'a.client_id')));

$user = JFactory::getUser();

if (!$user->authorise('core.admin') && $params->get('filter_groups', 0) == 1)
Expand Down

0 comments on commit c7cdcbe

Please sign in to comment.