get_value('class_distribution')) { $DB->query(" SELECT p.Name, COUNT(m.ID) AS Users FROM users_main AS m JOIN permissions AS p ON m.PermissionID = p.ID WHERE m.Enabled = '1' GROUP BY p.Name ORDER BY Users DESC"); $ClassDistribution = $DB->to_array(); $Cache->cache_value('class_distribution', $ClassDistribution, 3600 * 24 * 14); } if (!$PlatformDistribution = $Cache->get_value('platform_distribution')) { $DB->query(" SELECT OperatingSystem, COUNT(DISTINCT UserID) AS Users FROM users_sessions GROUP BY OperatingSystem ORDER BY Users DESC"); $PlatformDistribution = $DB->to_array(); $Cache->cache_value('platform_distribution', $PlatformDistribution, 3600 * 24 * 14); } if (!$BrowserDistribution = $Cache->get_value('browser_distribution')) { $DB->query(" SELECT Browser, COUNT(DISTINCT UserID) AS Users FROM users_sessions GROUP BY Browser ORDER BY Users DESC"); $BrowserDistribution = $DB->to_array(); $Cache->cache_value('browser_distribution', $BrowserDistribution, 3600 * 24 * 14); } // Timeline generation if (!list($Labels, $InFlow, $OutFlow) = $Cache->get_value('users_timeline')) { $DB->query(" SELECT DATE_FORMAT(JoinDate,\"%b %Y\") AS Month, COUNT(UserID) FROM users_info GROUP BY Month ORDER BY JoinDate DESC LIMIT 1, 11"); $TimelineIn = array_reverse($DB->to_array()); $DB->query(" SELECT DATE_FORMAT(BanDate,\"%b %Y\") AS Month, COUNT(UserID) FROM users_info WHERE BanDate > 0 GROUP BY Month ORDER BY BanDate DESC LIMIT 1, 11"); $TimelineOut = array_reverse($DB->to_array()); $Labels = []; foreach ($TimelineIn as $Month) { list($Labels[], $InFlow[]) = $Month; } foreach ($TimelineOut as $Month) { list(, $OutFlow[]) = $Month; } $Cache->cache_value('users_timeline', array($Labels, $InFlow, $OutFlow), mktime(0, 0, 0, date('n') + 1, 2)); //Tested: fine for Dec -> Jan } // End timeline generation View::show_header('User Statistics', $JSIncludes = 'vendor/chart.min'); ?>