/** * Determines all registered users who were online since a certain point of time. * @author Martin Helmich <*****@*****.**> * @param integer $time The point of time, since when the users are to be counted. * @param boolean $sesBackcheck Determines, of the user status is to be checked by session data. * @param boolean $postCount Determines, if the amount of posts created since $time is to be determined (can be * quite time-expensive) * @return array An array containing information on users who were online today. */ function getUsersFromTime($time, $sesBackcheck = FALSE, $postCount = TRUE) { $result = array('users', 'mods', "admins", 'count'); if (!ExtensionManagementUtility::isLoaded('sys_stat')) { $sesBackcheck = TRUE; } $grp_admin = array($this->getAdministratorGroup()); $grp_mod = $this->getModeratorGroups(); if ($sesBackcheck) { $res = $this->databaseHandle->exec_SELECTquery('u.usergroup, u.' . $this->tx_mmforum_pi1->getUserNameField() . ', u.uid', 'fe_users u, fe_sessions s', 's.ses_tstamp >= "' . $time . '" AND u.deleted=0 AND u.disable=0 AND u.uid=s.ses_userid ' . $this->getUserPidQuery('u'), 'ses_userid', 'username ASC'); } else { $res = $this->databaseHandle->exec_SELECTquery('u.usergroup, u.' . $this->tx_mmforum_pi1->getUserNameField() . ', u.uid', 'fe_users u, sys_stat s', 's.feuser_id != "0" AND u.uid = s.feuser_id AND s.tstamp >= "' . $time . '" ' . $this->getUserPidQuery('u'), 'feuser_id'); } while ($arr = $this->databaseHandle->sql_fetch_assoc($res)) { if ($postCount) { $res2 = $this->databaseHandle->exec_SELECTquery('COUNT(*)', 'tx_mmforum_posts', 'poster_id="' . $arr['uid'] . '" AND post_time >= "' . $time . '"' . $this->cObj->enableFields('tx_mmforum_posts') . ' ' . $this->getStoragePIDQuery()); $arr2 = $this->databaseHandle->sql_fetch_row($res2); $arr['postCount'] = $arr2[0]; } $user_groups = GeneralUtility::intExplode(',', $arr['usergroup']); if (count(array_intersect($user_groups, $grp_mod)) > 0) { $result['mods'][] = $arr; } elseif (count(array_intersect($user_groups, $grp_admin)) > 0) { $result['admins'][] = $arr; } else { $result['users'][] = $arr; } } $result['count'] = $this->databaseHandle->sql_num_rows($res); return $result; }