242 if (
$res =
$db->query(
"SELECT phpSessionID FROM {users_online}"))
244 while ($row =
$res->fetch_assoc())
248 $this->currentOnline =
$i;
266 $sessionExpire = time()-60;
268 if (
$db->query(
"DELETE FROM {users_online} WHERE currentTimeStamp < $sessionExpire"))
289 $this->phpSessionID = session_id();
290 $this->currentTimeStamp = time();
291 if (!isset($_SESSION[
'uid']) || (empty($_SESSION[
'uid'])))
294 { $this->uid = $_SESSION[
'uid']; }
297 if (isset($this->phpSessionID) && (isset($this->currentTimeStamp)))
300 if ($row =
$db->query(
"SELECT * from {users_online}
301 WHERE phpSessionID = '$this->phpSessionID'"))
304 if (
$res = $row->fetch_assoc())
307 $this->currentTimeStamp = time();
309 if ($row =
$db->query(
"UPDATE {users_online}
310 SET currentTimeStamp = '$this->currentTimeStamp'
311 WHERE phpSessionID = '$this->phpSessionID'"))
323 if (
$db->query(
"INSERT INTO {users_online}
327 VALUES ('".$this->phpSessionID.
"',
329 '".$this->currentTimeStamp.
"')"))
341 if (
$db->query(
"INSERT INTO {users_online}
344 VALUES ('".$this->phpSessionID.
"',
345 '".$this->currentTimeStamp.
"')"))
380 \YAWK\sys::setSyslog(
$db, 43, 1,
"could not insert stats into database.",
"",
"",
"",
"");
394 if (isset($_SESSION) && (!empty($_SESSION)))
397 $this->phpSessionID = session_id();
399 $this->currentTimeStamp=time();
402 if (isset($_SESSION[
'uid']) && (!empty($_SESSION[
'uid'])))
404 $this->uid = $_SESSION[
'uid'];
406 if (isset($_SESSION[
'gid']) && (!empty($_SESSION[
'gid'])))
408 $this->
gid = $_SESSION[
'gid'];
410 if (isset($_SESSION[
'logged_in']) && (!empty($_SESSION[
'logged_in'])))
412 $this->logged_in = $_SESSION[
'logged_in'];
420 $this->logged_in = 0;
423 $this->remoteAddr = $_SERVER[
'REMOTE_ADDR'];
427 $this->userAgent = $_SERVER[
'HTTP_USER_AGENT'];
431 require_once
'system/engines/mobiledetect/Mobile_Detect.php';
432 $detect = new \YAWK\Mobile_Detect();
434 $this->deviceType = ($detect->isMobile() ? ($detect->isTablet() ?
'Tablet' :
'Phone') :
'Desktop');
437 if ( $detect->isMobile() ) {
442 $this->browserVersion =
$browser[
'version'];
446 if( $detect->isTablet() ){
451 $this->browserVersion =
$browser[
'version'];
455 if( !$detect->isMobile() && !$detect->isTablet() ){
460 $this->browserVersion =
$browser[
'version'];
461 $this->os = ucfirst(
$browser[
'platform']);
466 if ( $detect->version(
'iPhone') ) {
467 $this->device =
"iPhone";
469 $this->osVersion = $detect->version(
'iPhone');
471 if ( $detect->version(
'iPad') ) {
472 $this->device =
"iPad";
474 $this->osVersion = $detect->version(
'iPad');
476 if ( $detect->version(
'iPod') ) {
477 $this->device =
"iPod";
479 $this->osVersion = $detect->version(
'iPod');
481 if( $detect->version(
'Android') ){
482 $this->os =
"Android";
483 $this->osVersion = $detect->version(
'Android');
488 $this->acceptLanguage = $_SERVER[
'HTTP_ACCEPT_LANGUAGE'];
491 if (!isset($_SERVER[
'HTTP_REFERER']) || (empty($_SERVER[
'HTTP_REFERER'])))
497 $this->referer = $_SERVER[
'HTTP_REFERER'];
500 if (!isset(
$_GET[
'include']) || (empty(
$_GET[
'include'])))
502 $this->
page = $_SERVER[
'REQUEST_URI'];
522 if (
$res =
$db->query(
"SELECT COUNT(*) FROM {plugin_msg}"))
524 $messageCount = mysqli_fetch_row(
$res);
525 return $messageCount[0];
529 $messageCount =
"db error: could not count messages";
530 return $messageCount;
542 if (
$res =
$db->query(
"SELECT id, blocked, online, logged_in FROM {users}"))
544 while ($user = mysqli_fetch_assoc(
$res))
550 if ($user[
'blocked'] ===
"1")
552 $this->i_blockedUsers++;
556 if ($user[
'online'] ===
"1")
558 $this->i_loggedInUsers++;
584 if (
$res =
$db->query(
"SELECT * FROM {logins}"))
586 $loginDataArray = array();
588 while ($row = mysqli_fetch_assoc(
$res))
594 $this->i_totalLogins++;
597 if ($row[
'location'] ===
"frontend")
600 $this->i_loginFrontend++;
601 if ($row[
'failed'] ===
"1")
603 $this->i_loginFrontendFailed++;
607 $this->i_loginFrontendSuccess++;
611 if ($row[
'location'] ===
"backend")
613 $this->i_loginBackend++;
614 if ($row[
'failed'] ===
"1")
616 $this->i_loginBackendFailed++;
620 $this->i_loginBackendSuccess++;
624 if ($row[
'failed'] ===
"0")
626 $this->i_loginSuccessful++;
629 if ($row[
'failed'] ===
"1")
631 $this->i_loginFailed++;
634 if ($this->i_totalLogins > 0)
641 $this->i_loginFailedPercentage = round(
$total * $failed);
642 $this->i_loginSuccessPercentage = round(
$total * $success);
647 $loginDataArray = array(
648 "Failed" => $this->i_loginFailed,
649 "Successful" => $this->i_loginSuccessful,
650 "BackendSuccess" => $this->i_loginBackendSuccess,
651 "BackendFailed" => $this->i_loginBackendFailed,
652 "FrontendSuccess" => $this->i_loginFrontendSuccess,
653 "FrontendFailed" => $this->i_loginFrontendFailed,
654 "FailedPercentage" => $this->i_loginFailedPercentage,
655 "SuccessPercentage" => $this->i_loginSuccessPercentage,
656 "Total" => $this->i_totalLogins
658 return $loginDataArray;
662 \YAWK\alert::draw(
"warning",
"Could not get login data array.",
"error getting data into array",
"", 5200);
678 if (!isset($logins) || (empty($logins)))
683 foreach ($logins AS $login =>
$value)
688 if ($login ===
"Failed") { $textcolor =
"#f56954"; }
689 if ($login ===
"Successful") { $textcolor =
"#00a65a"; }
692 if ($login !== (
"Total") && ($login === (
"Failed") || ($login === (
"Successful"))))
697 color: \"$textcolor\",
698 highlight: \"$textcolor\",
720 if (!isset($daytimes) || (empty($daytimes)))
725 foreach ($daytimes AS $daytime =>
$value)
730 if ($daytime ===
"$lang[MORNING]") { $textcolor =
"#f39c12"; }
731 if ($daytime ===
"$lang[AFTERNOON]") { $textcolor =
"#00a65a"; }
732 if ($daytime ===
"$lang[EVENING]") { $textcolor =
"#00c0ef"; }
733 if ($daytime ===
"$lang[NIGHT]") { $textcolor =
"#003D4C"; }
736 if ($daytime !== (
"$lang[TOTAL]") &&
737 ($daytime === (
"$lang[MORNING]") ||
738 ($daytime === (
"$lang[AFTERNOON]") ||
739 ($daytime === (
"$lang[EVENING]") ||
740 ($daytime === (
"$lang[NIGHT]"))))))
745 color: \"$textcolor\",
746 highlight: \"$textcolor\",
767 if (!isset($daytimes) || (empty($daytimes)))
772 $jsonData =
"labels: ['$lang[MORNING]', '$lang[AFTERNOON]', '$lang[EVENING]', '$lang[NIGHT]'],
775 label: '$lang[HITS]',
776 fillColor: ['#f39c12', '#00a65a', '#00c0ef', '#003D4C'],
777 strokeColor: 'rgba(210, 214, 222, 1)',
778 pointColor: 'rgba(210, 214, 222, 1)',
779 pointStrokeColor: '#c1c7d1',
780 pointHighlightFill: '#fff',
781 pointHighlightStroke: 'rgba(220,220,220,1)',
782 data: [$this->i_morning, $this->i_afternoon, $this->i_evening, $this->i_night]
798 if (!isset($daytimes) || (empty($daytimes)))
803 $jsonData =
"labels: ['$lang[MORNING]', '$lang[AFTERNOON]', '$lang[EVENING]', '$lang[NIGHT]'],
806 label: '$lang[HITS]',
807 fillColor: ['#f39c12', '#00a65a', '#00c0ef', '#003D4C'],
808 strokeColor: 'rgba(210, 214, 222, 1)',
809 pointColor: 'rgba(210, 214, 222, 1)',
810 pointStrokeColor: '#c1c7d1',
811 pointHighlightFill: '#fff',
812 pointHighlightStroke: 'rgba(220,220,220,1)',
813 data: [$this->i_morning, $this->i_afternoon, $this->i_evening, $this->i_night]
826 $jsonData =
"labels: ['$lang[MONDAY]', '$lang[TUESDAY]', '$lang[WEDNESDAY]', '$lang[THURSDAY]', '$lang[FRIDAY]', '$lang[SATURDAY]', '$lang[SUNDAY]'],
830 fillColor: ['#ebebeb', '#ebebeb', '#ebebeb', '#ebebeb', '#ebebeb', '#ebebeb', '#ebebeb'],
831 strokeColor: 'rgba(210, 214, 222, 1)',
832 pointColor: 'rgba(210, 214, 222, 1)',
833 pointStrokeColor: '#c1c7d1',
834 pointHighlightFill: '#fff',
835 pointHighlightStroke: 'rgba(220,220,220,1)',
836 data: [$this->i_monday, $this->i_tuesday, $this->i_wednesday, $this->i_thursday, $this->i_friday, $this->i_saturday, $this->i_sunday]
852 if (!isset($browsers) || (empty($browsers)))
862 if (
$browser ===
"Chrome") { $textcolor =
"#f56954"; }
863 if (
$browser ===
"IE") { $textcolor =
"#00a65a"; }
864 if (
$browser ===
"Edge") { $textcolor =
"#00a65a"; }
865 if (
$browser ===
"Kindle") { $textcolor =
"#239330"; }
866 if (
$browser ===
"Firefox") { $textcolor =
"#f39c12"; }
867 if (
$browser ===
"Safari") { $textcolor =
"#00c0ef"; }
868 if (
$browser ===
"Opera") { $textcolor =
"#3c8dbc"; }
869 if (
$browser ===
"Netscape") { $textcolor =
"#d2d6de"; }
870 if (
$browser ===
"Others") { $textcolor =
"#cccccc"; }
878 color: \"$textcolor\",
879 highlight: \"$textcolor\",
899 if (!isset($oss) || (empty($oss)))
909 if (
$os ===
"Windows") { $textcolor =
"#00c0ef"; }
910 if (
$os ===
"Linux") { $textcolor =
"#f56954"; }
911 if (
$os ===
"Mac") { $textcolor =
"#f39c12"; }
912 if (
$os ===
"Android") { $textcolor =
"#00a65a"; }
913 if (
$os ===
"iOS") { $textcolor =
"#000000"; }
914 if (
$os ===
"Unknown") { $textcolor =
"#cccccc"; }
917 if (
$os !== (
"Total"))
922 color: \"$textcolor\",
923 highlight: \"$textcolor\",
943 if (!isset($osVersions) || (empty($osVersions)))
953 if (
$osVersion ===
"Windows 11") { $textcolor =
"#00c0ef"; }
954 if (
$osVersion ===
"Windows 10") { $textcolor =
"#00c0ef"; }
955 if (
$osVersion ===
"Windows 8") { $textcolor =
"#00c0ef"; }
956 if (
$osVersion ===
"Windows 7") { $textcolor =
"#00A0C7"; }
957 if (
$osVersion ===
"Windows Vista") { $textcolor =
"#00B5E1"; }
958 if (
$osVersion ===
"Windows Server") { $textcolor =
"#004E61"; }
959 if (
$osVersion ===
"Windows 2000") { $textcolor =
"#005A7F"; }
960 if (
$osVersion ===
"Windows XP") { $textcolor =
"#00B5FF"; }
961 if (
$osVersion ===
"Windows ME") { $textcolor =
"#0090C9"; }
962 if (
$osVersion ===
"Windows 98") { $textcolor =
"#00A5E5"; }
963 if (
$osVersion ===
"Windows 95") { $textcolor =
"#0089BF"; }
964 if (
$osVersion ===
"Windows 3.11") { $textcolor =
"#00ACBF"; }
965 if (
$osVersion ===
"Mac OS X") { $textcolor =
"#f39c12"; }
966 if (
$osVersion ===
"Mac OS 9") { $textcolor =
"#BD7A0E"; }
967 if (
$osVersion ===
"Linux") { $textcolor =
"#f56954"; }
968 if (
$osVersion ===
"Ubuntu") { $textcolor =
"#BF5242"; }
969 if (
$osVersion ===
"iPhone") { $textcolor =
"#212121"; }
970 if (
$osVersion ===
"iPad") { $textcolor =
"#131313"; }
971 if (
$osVersion ===
"iPod") { $textcolor =
"#212121"; }
972 if (
$osVersion ===
"Android") { $textcolor =
"#6FF576"; }
973 if (
$osVersion ===
"Blackberry") { $textcolor =
"#187521"; }
974 if (
$osVersion ===
"Mobile") { $textcolor =
"#437540"; }
975 if (
$osVersion ===
"Unknown") { $textcolor =
"#6B756D"; }
983 color: \"$textcolor\",
984 highlight: \"$textcolor\",
985 label: \"$osVersion\"
1005 if (!isset($deviceTypes) || (empty($deviceTypes)))
1010 $jsonData =
"labels: ['$lang[DESKTOP]', '$lang[PHONE]', '$lang[TABLET]'],
1014 fillColor: ['#f39c12', '#00a65a', '#00c0ef'],
1015 strokeColor: 'rgba(210, 214, 222, 1)',
1016 pointColor: 'rgba(210, 214, 222, 1)',
1017 pointStrokeColor: '#c1c7d1',
1018 pointHighlightFill: '#fff',
1019 pointHighlightStroke: 'rgba(220,220,220,1)',
1020 data: [$this->i_desktop, $this->i_phone, $this->i_tablet]
1037 $textcolor =
"text-red";
1039 case "Google Chrome":
1040 $textcolor =
"text-red";
1043 $textcolor =
"text-green";
1045 case "Internet Explorer":
1046 $textcolor =
"text-green";
1049 $textcolor =
"text-yellow";
1051 case "Mozilla Firefox":
1052 $textcolor =
"text-yellow";
1055 $textcolor =
"text-aqua";
1057 case "Apple Safari":
1058 $textcolor =
"text-aqua";
1061 $textcolor =
"text-light-blue";
1064 $textcolor =
"text-grey";
1067 $textcolor =
"text-grey";
1070 $textcolor =
"text-black";
1085 $textcolor =
"text-blue";
1088 $textcolor =
"text-red";
1091 $textcolor =
"text-orange";
1094 $textcolor =
"text-green";
1097 $textcolor =
"text-grey";
1100 $textcolor =
"text-black";
1115 $textcolor =
"text-orange";
1118 $textcolor =
"text-green";
1121 $textcolor =
"text-blue";
1124 $textcolor =
"text-black";
1137 case "$lang[MORNING]":
1138 $textcolor =
"text-orange";
1140 case "$lang[AFTERNOON]":
1141 $textcolor =
"text-green";
1143 case "$lang[EVENING]":
1144 $textcolor =
"text-blue";
1146 case "$lang[NIGHT]":
1147 $textcolor =
"text-navy";
1150 $textcolor =
"text-black";
1164 $textcolor =
"text-red";
1166 case "FailedPercentage":
1167 $textcolor =
"text-red";
1169 case "SuccessPercentage":
1170 $textcolor =
"text-green";
1173 $textcolor =
"text-green";
1176 $textcolor =
"text-blue";
1179 $textcolor =
"text-orange";
1182 $textcolor =
"text-black";
1195 switch ($osVersions) {
1197 $textcolor =
"text-blue";
1200 $textcolor =
"text-blue";
1203 $textcolor =
"text-blue";
1205 case "Windows Vista":
1206 $textcolor =
"text-blue";
1208 case "Windows Server":
1209 $textcolor =
"text-blue";
1211 case "Windows 2000":
1212 $textcolor =
"text-blue";
1215 $textcolor =
"text-blue";
1218 $textcolor =
"text-blue";
1221 $textcolor =
"text-blue";
1224 $textcolor =
"text-blue";
1226 case "Windows 3.11":
1227 $textcolor =
"text-blue";
1230 $textcolor =
"text-blue";
1233 $textcolor =
"text-orange";
1236 $textcolor =
"text-orange";
1239 $textcolor =
"text-red";
1242 $textcolor =
"text-red";
1245 $textcolor =
"text-black";
1248 $textcolor =
"text-black";
1251 $textcolor =
"text-black";
1254 $textcolor =
"text-green";
1257 $textcolor =
"text-green";
1260 $textcolor =
"text-green";
1263 $textcolor =
"text-grey";
1266 $textcolor =
"text-black";
1284 if (!isset($limit) || (empty($limit)))
1290 $limitSql =
' LIMIT '.$limit;
1295 if (
$res =
$db->query(
"SELECT date_created FROM {stats} ORDER BY id DESC$limitSql"))
1298 while ($row = mysqli_fetch_assoc(
$res))
1323 if ($weekday ===
"Monday" ||
1324 ($weekday ===
"$lang[MONDAY]"))
1328 elseif ($weekday ===
"Tuesday" ||
1329 ($weekday ===
"$lang[TUESDAY]"))
1333 elseif ($weekday ===
"Wednesday" ||
1334 ($weekday ===
"$lang[WEDNESDAY]"))
1336 $this->i_wednesday++;
1338 elseif ($weekday ===
"Thursday" ||
1339 ($weekday ===
"$lang[THURSDAY]"))
1341 $this->i_thursday++;
1343 elseif ($weekday ===
"Friday" ||
1344 ($weekday ===
"$lang[FRIDAY]"))
1348 elseif ($weekday ===
"Saturday" ||
1349 ($weekday ===
"$lang[SATURDAY]"))
1351 $this->i_saturday++;
1353 elseif ($weekday ===
"Sunday" ||
1354 ($weekday ===
"$lang[SUNDAY]"))
1361 $this->i_totalDays = $this->i_monday
1371 "$lang[MONDAY]" => $this->i_monday,
1372 "$lang[TUESDAY]" => $this->i_tuesday,
1373 "$lang[WEDNESDAY]" => $this->i_wednesday,
1374 "$lang[THURSDAY]" => $this->i_thursday,
1375 "$lang[FRIDAY]" => $this->i_friday,
1376 "$lang[SATURDAY]" => $this->i_saturday,
1377 "$lang[SUNDAY]" => $this->i_sunday,
1378 "$lang[TOTAL]" => $this->i_totalDays
1392 if ($this->i_totalDays > 0)
1396 $this->i_mondayPercent = round($a * $this->i_monday);
1397 $this->i_tuesdayPercent = round($a * $this->i_tuesday);
1398 $this->i_wednesdayPercent = round($a * $this->i_wednesday);
1399 $this->i_thursdayPercent = round($a * $this->i_thursday);
1400 $this->i_fridayPercent = round($a * $this->i_friday);
1401 $this->i_saturdayPercent = round($a * $this->i_saturday);
1402 $this->i_sundayPercent = round($a * $this->i_sunday);
1405 $weekdaysPercent = array(
1406 "$lang[MONDAY]" => $this->i_mondayPercent,
1407 "$lang[TUESDAY]" => $this->i_tuesdayPercent,
1408 "$lang[WEDNESDAY]" => $this->i_wednesdayPercent,
1409 "$lang[THURSDAY]" => $this->i_thursdayPercent,
1410 "$lang[FRIDAY]" => $this->i_fridayPercent,
1411 "$lang[SATURDAY]" => $this->i_saturdayPercent,
1412 "$lang[SUNDAY]" => $this->i_sundayPercent
1414 arsort($weekdaysPercent);
1415 return $weekdaysPercent;
1445 if (
$res =
$db->query(
"SELECT date_created FROM {stats} ORDER BY id DESC"))
1448 while ($row = mysqli_fetch_assoc(
$res))
1471 $hour = substr(
$value[
'date_created'], 11, -6);
1474 if ($hour ===
"06" ||
1483 if ($hour ===
"12" ||
1490 $this->i_afternoon++;
1492 if ($hour ===
"18" ||
1501 if ($hour ===
"00" ||
1517 "$lang[MORNING]" => $this->i_morning,
1518 "$lang[AFTERNOON]" => $this->i_afternoon,
1519 "$lang[EVENING]" => $this->i_evening,
1520 "$lang[NIGHT]" => $this->i_night,
1544 $this->i_morningPercent = round($a * $this->i_morning);
1545 $this->i_afternoonPercent = round($a * $this->i_afternoon);
1546 $this->i_eveningPercent = round($a * $this->i_evening);
1547 $this->i_nightPercent = round($a * $this->i_night);
1551 $dayTimesPercent = array(
1552 "$lang[MORNING]" => $this->i_morningPercent,
1553 "$lang[AFTERNOON]" => $this->i_afternoonPercent,
1554 "$lang[EVENING]" => $this->i_eveningPercent,
1555 "$lang[NIGHT]" => $this->i_nightPercent
1557 arsort($dayTimesPercent);
1558 return $dayTimesPercent;
1599 if (
$res =
$db->query(
"SELECT browser FROM {stats} ORDER BY id DESC"))
1602 while ($row = mysqli_fetch_assoc(
$res))
1625 case "Google Chrome":
1628 case "Internet Explorer":
1631 case "Mozilla Firefox":
1634 case "Apple Safari":
1648 $total = $n_chrome+$n_msie+$n_firefox+$n_safari+$n_opera+$n_netscape+$n_others;
1652 "Chrome" => $n_chrome,
1654 "Firefox" => $n_firefox,
1655 "Safari" => $n_safari,
1656 "Opera" => $n_opera,
1657 "Netscape" => $n_netscape,
1658 "Others" => $n_others,
1688 $intervalQuery =
"WHERE {stats}.date_created > DATE_SUB(CURDATE(), INTERVAL 1 DAY)";
1689 if (
$res =
$db->query(
"SELECT deviceType FROM {stats} $intervalQuery ORDER BY id DESC"))
1692 while ($row = mysqli_fetch_assoc(
$res))
1713 switch (
$value[
'deviceType'])
1737 $deviceTypes = array(
1738 "Desktop" => $this->i_desktop,
1739 "Tablet" => $this->i_tablet,
1740 "Phone" => $this->i_phone,
1744 return $deviceTypes;
1774 if (
$res =
$db->query(
"SELECT os FROM {stats} ORDER BY id DESC"))
1777 while ($row = mysqli_fetch_assoc(
$res))
1801 $this->i_osWindows++;
1810 $this->i_osAndroid++;
1815 default: $this->i_osUnknown++;
1823 "Windows" => $this->i_osWindows,
1824 "Linux" => $this->i_osLinux,
1825 "Mac" => $this->i_osMac,
1826 "Android" => $this->i_osAndroid,
1827 "iOS" => $this->i_iOS,
1828 "Unknown" => $this->i_osUnknown,
1857 if (
$res =
$db->query(
"SELECT osVersion FROM {stats} ORDER BY id DESC"))
1860 while ($row = mysqli_fetch_assoc(
$res))
1885 $osVersion[
'osVersion'] .=
"Android ".$osVersion[
'osVersion'];
1890 $this->i_windows11++;
1893 $this->i_windows10++;
1896 $this->i_windows8++;
1899 $this->i_windows7++;
1901 case "Windows Vista";
1902 $this->i_windowsVista++;
1904 case "Windows Server 2003/XP x64";
1905 $this->i_windowsServer++;
1908 $this->i_windowsXP++;
1910 case "Windows 2000";
1911 $this->i_windows2000++;
1914 $this->i_windowsME++;
1917 $this->i_windows98++;
1920 $this->i_windows95++;
1922 case "Windows 3.11";
1923 $this->i_windows311++;
1950 $this->i_blackberry++;
1963 $total = $this->i_windows11
1967 +$this->i_windowsVista
1968 +$this->i_windowsServer
1969 +$this->i_windows2000
1974 +$this->i_windows311
1983 +$this->i_blackberry
1987 $osVersions = array(
1988 "Windows 11" => $this->i_windows11,
1989 "Windows 10" => $this->i_windows10,
1990 "Windows 8" => $this->i_windows8,
1991 "Windows 7" => $this->i_windows7,
1992 "Windows Vista" => $this->i_windowsVista,
1993 "Windows Server" => $this->i_windowsServer,
1994 "Windows 2000" => $this->i_windows2000,
1995 "Windows XP" => $this->i_windowsXP,
1996 "Windows ME" => $this->i_windowsME,
1997 "Windows 98" => $this->i_windows98,
1998 "Windows 95" => $this->i_windows95,
1999 "Windows 3.11" => $this->i_windows311,
2000 "Mac OS X" => $this->i_macosX,
2001 "Mac OS 9" => $this->i_macos9,
2002 "Linux" => $this->i_linux,
2003 "Ubuntu" => $this->i_ubuntu,
2004 "iPhone" => $this->i_iPhone,
2005 "iPad" => $this->i_iPad,
2006 "iPod" => $this->i_iPod,
2007 "Android" => $this->i_android,
2008 "Blackberry" => $this->i_blackberry,
2009 "Mobile" => $this->i_mobile,
2010 "Unknown" => $this->i_others,
2033 if (!isset($period) || (empty($period)))
2038 if (!isset($interval) || (empty($interval)))
2040 $intervalQuery =
'';
2043 if (isset($interval) && (isset($period)))
2049 $intervalQuery =
'';
2055 $intervalQuery =
"WHERE {stats}.date_created > DATE_SUB(NOW(), INTERVAL $interval $period)";
2060 $intervalQuery =
'';
2064 if (
$res =
$db->query(
"SELECT * FROM {stats} $intervalQuery ORDER BY date_created DESC"))
2066 $statsArray = array();
2068 while ($row =
$res->fetch_assoc())
2070 $statsArray[] = $row;
2075 \YAWK\sys::setSyslog(
$db, 43, 1,
"failed to get stats from database.", 0, 0, 0, 0);
2076 \YAWK\alert::draw(
"warning",
"Warning!",
"Fetch database error: getStatsArray failed.",
"",
"4800");
2080 if (is_array($statsArray) && (!empty($statsArray)))
2112 if (
$item[
'logged_in'] ===
"1")
2114 $this->i_loggedUsers++;
2118 if (
$item[
'logged_in'] ===
"0")
2120 $this->i_publicUsers++;
2125 $this->i_loggedUsersPercentage = $this->i_loggedUsers * $percentage;
2126 $this->i_publicUsersPercentage = $this->i_publicUsers * $percentage;
2127 $this->i_loggedUsersPercentage = round($this->i_loggedUsersPercentage, 1, PHP_ROUND_HALF_UP);
2128 $this->i_publicUsersPercentage = round($this->i_publicUsersPercentage, 1, PHP_ROUND_HALF_UP);
2151 if (
$db->query(
"INSERT INTO {stats}
2167 VALUES ('".$this->uid.
"',
2169 '".$this->logged_in.
"',
2170 '".$this->acceptLanguage.
"',
2171 '".$this->remoteAddr.
"',
2172 '".$this->userAgent.
"',
2173 '".$this->device.
"',
2174 '".$this->deviceType.
"',
2176 '".$this->osVersion.
"',
2177 '".$this->browser.
"',
2178 '".$this->browserVersion.
"',
2179 '".$this->date_created.
"',
2180 '".$this->referer.
"',
2181 '".$this->page.
"')"))
2199 if (self::getUserStats(
$db))
2201 echo
"<!-- user settings box -->
2203 <div class=\"box-header with-border\">
2204 <h3 class=\"box-title\">$lang[USER] $lang[STATS] <small>$lang[TOTAL_LOGGED_BLOCKED]</small></h3>
2206 <div class=\"box-body\">
2207 $lang[USERS]: <b>$this->i_users</b><br>
2208 $lang[BLOCKED]: <b>$this->i_blockedUsers</b><br>
2209 $lang[LOGGED_IN]: <b>$this->i_loggedInUsers</b>
2212 <!-- / stats settings box -->";
2230 echo
"<!-- donut box: -->
2231 <div class=\"box box-default\">
2232 <div class=\"box-header with-border\">
2233 <h3 class=\"box-title\">$lang[OPERATING_SYSTEMS] <small>($lang[BETA])</small></h3>
2235 <div class=\"box-tools pull-right\">
2236 <button type=\"button\" class=\"btn btn-box-tool\" data-widget=\"collapse\"><i class=\"fa fa-minus\"></i>
2238 <button type=\"button\" class=\"btn btn-box-tool\" data-widget=\"remove\"><i class=\"fa fa-times\"></i></button>
2241 <!-- /.box-header -->
2242 <div class=\"box-body\">
2244 <div class=\"col-md-8\">
2245 <div class=\"chart-responsive\">
2246 <canvas id=\"pieChartOS\" height=\"150\"></canvas>
2248 <!-- ./chart-responsive -->
2251 <div class=\"col-md-4\">
2252 <ul class=\"chart-legend clearfix\">
2254 <script> //-------------
2258 // Get context with jQuery - using jQuery's .get() method.
2259 var pieChartCanvas = $('#pieChartOS').get(0).getContext('2d');
2260 var pieChart = new Chart(pieChartCanvas);
2261 // get browsers array
2262 // output js data with php function getJsonBrowsers
2266 //Boolean - Whether we should show a stroke on each segment
2267 segmentShowStroke: true,
2268 //String - The colour of each segment stroke
2269 segmentStrokeColor: '#fff',
2270 //Number - The width of each segment stroke
2271 segmentStrokeWidth: 1,
2272 //Number - The percentage of the chart that we cut out of the middle
2273 percentageInnerCutout: 50, // This is 0 for Pie charts
2274 //Number - Amount of animation steps
2275 animationSteps: 100,
2276 //String - Animation easing effect
2277 animationEasing: 'easeOutBounce',
2278 //Boolean - Whether we animate the rotation of the Doughnut
2279 animateRotate: true,
2280 //Boolean - Whether we animate scaling the Doughnut from the centre
2281 animateScale: false,
2282 //Boolean - whether to make the chart responsive to window resizing
2284 // Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container
2285 maintainAspectRatio: false,
2286 //String - A legend template
2287 legendTemplate: '<ul class=\"<%=name.toLowerCase() %>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor %>\"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>',
2288 //String - A tooltip template
2289 tooltipTemplate: '<%=value %> <%=label%>'
2291 //Create pie or douhnut chart
2292 // You can switch between pie and douhnut using the method below.
2293 pieChart.Doughnut(PieData, pieOptions);
2296 //-----------------</script>";
2305 echo
"<li><i class=\"fa fa-circle-o $textcolor\"></i> <b>$value</b> $os</li>";
2308 if (
$os ===
"Total")
2310 echo
"<li class=\"small\">$lang[LATEST] $value $lang[USERS]</li>";
2321 <div class=\"box-footer no-padding\">
2322 <ul class=\"nav nav-pills nav-stacked\">";
2325 $oss[] = arsort($oss);
2332 echo
"<li><a href=\"#\" class=\"$textcolor\">$os
2333 <span class=\"pull-right $textcolor\" ><i class=\"fa fa-angle-down\"></i>$value</span></a></li>";
2358 echo
"<!-- donut box: -->
2359 <div class=\"box box-default\">
2360 <div class=\"box-header with-border\">
2361 <h3 class=\"box-title\">$lang[BROWSER] <small>$lang[USAGE]</small></h3>
2363 <div class=\"box-tools pull-right\">
2364 <button type=\"button\" class=\"btn btn-box-tool\" data-widget=\"collapse\"><i class=\"fa fa-minus\"></i>
2366 <button type=\"button\" class=\"btn btn-box-tool\" data-widget=\"remove\"><i class=\"fa fa-times\"></i></button>
2369 <!-- /.box-header -->
2370 <div class=\"box-body\">
2372 <div class=\"col-md-8\">
2373 <div class=\"chart-responsive\">
2374 <canvas id=\"pieChartBrowser\" height=\"150\"></canvas>
2376 <!-- ./chart-responsive -->
2379 <div class=\"col-md-4\">
2380 <ul class=\"chart-legend clearfix\">
2382 <script> //-------------
2386 // Get context with jQuery - using jQuery's .get() method.
2387 var pieChartCanvas = $('#pieChartBrowser').get(0).getContext('2d');
2388 var pieChart = new Chart(pieChartCanvas);
2389 // get browsers array
2390 // output js data with php function getJsonBrowsers
2394 //Boolean - Whether we should show a stroke on each segment
2395 segmentShowStroke: true,
2396 //String - The colour of each segment stroke
2397 segmentStrokeColor: '#fff',
2398 //Number - The width of each segment stroke
2399 segmentStrokeWidth: 1,
2400 //Number - The percentage of the chart that we cut out of the middle
2401 percentageInnerCutout: 50, // This is 0 for Pie charts
2402 //Number - Amount of animation steps
2403 animationSteps: 100,
2404 //String - Animation easing effect
2405 animationEasing: 'easeOutBounce',
2406 //Boolean - Whether we animate the rotation of the Doughnut
2407 animateRotate: true,
2408 //Boolean - Whether we animate scaling the Doughnut from the centre
2409 animateScale: false,
2410 //Boolean - whether to make the chart responsive to window resizing
2412 // Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container
2413 maintainAspectRatio: false,
2414 //String - A legend template
2415 legendTemplate: '<ul class=\"<%=name.toLowerCase() %>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor %>\"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>',
2416 //String - A tooltip template
2417 tooltipTemplate: '<%=value %> <%=label%> users'
2419 //Create pie or douhnut chart
2420 // You can switch between pie and douhnut using the method below.
2421 pieChart.Doughnut(PieData, pieOptions);
2424 //-----------------</script>";
2433 echo
"<li><i class=\"fa fa-circle-o $textcolor\"></i> <b>$value</b> $browser</li>";
2438 echo
"<li class=\"small\">$lang[LATEST] $value $lang[VISITORS]</li>";
2449 <div class=\"box-footer no-padding\">
2450 <ul class=\"nav nav-pills nav-stacked\">";
2453 $browsers[] = arsort($browsers);
2460 echo
"<li><a href=\"#\" class=\"$textcolor\">$browser
2461 <span class=\"pull-right $textcolor\" ><i class=\"fa fa-angle-down\"></i>$value</span></a></li>";
2486 echo
"<!-- donut box: -->
2487 <div class=\"box box-default\">
2488 <div class=\"box-header with-border\">
2489 <h3 class=\"box-title\">$lang[OPERATING_SYSTEM] $lang[VERSIONS] <small>($lang[BETA])</small></h3>
2491 <div class=\"box-tools pull-right\">
2492 <button type=\"button\" class=\"btn btn-box-tool\" data-widget=\"collapse\"><i class=\"fa fa-minus\"></i>
2494 <button type=\"button\" class=\"btn btn-box-tool\" data-widget=\"remove\"><i class=\"fa fa-times\"></i></button>
2497 <!-- /.box-header -->
2498 <div class=\"box-body\">
2500 <div class=\"col-md-8\">
2501 <div class=\"chart-responsive\">
2502 <canvas id=\"pieChartOSVersion\" height=\"150\"></canvas>
2504 <!-- ./chart-responsive -->
2507 <div class=\"col-md-4\">
2508 <ul class=\"chart-legend clearfix\">
2510 <script> //-------------
2514 // Get context with jQuery - using jQuery's .get() method.
2515 var pieChartCanvas = $('#pieChartOSVersion').get(0).getContext('2d');
2516 var pieChart = new Chart(pieChartCanvas);
2517 // get browsers array
2518 // output js data with php function getJsonBrowsers
2522 //Boolean - Whether we should show a stroke on each segment
2523 segmentShowStroke: true,
2524 //String - The colour of each segment stroke
2525 segmentStrokeColor: '#fff',
2526 //Number - The width of each segment stroke
2527 segmentStrokeWidth: 1,
2528 //Number - The percentage of the chart that we cut out of the middle
2529 percentageInnerCutout: 50, // This is 0 for Pie charts
2530 //Number - Amount of animation steps
2531 animationSteps: 100,
2532 //String - Animation easing effect
2533 animationEasing: 'easeOutBounce',
2534 //Boolean - Whether we animate the rotation of the Doughnut
2535 animateRotate: true,
2536 //Boolean - Whether we animate scaling the Doughnut from the centre
2537 animateScale: false,
2538 //Boolean - whether to make the chart responsive to window resizing
2540 // Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container
2541 maintainAspectRatio: false,
2542 //String - A legend template
2543 legendTemplate: '<ul class=\"<%=name.toLowerCase() %>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor %>\"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>',
2544 //String - A tooltip template
2545 tooltipTemplate: '<%=value %> <%=label%>'
2547 //Create pie or douhnut chart
2548 // You can switch between pie and douhnut using the method below.
2549 pieChart.Doughnut(PieData, pieOptions);
2552 //-----------------</script>";
2561 echo
"<li><i class=\"fa fa-circle-o $textcolor\"></i> <b>$value</b> $osVersion</li>";
2566 echo
"<li class=\"small\">$lang[LATEST] $value $lang[HITS]</li>";
2577 <div class=\"box-footer no-padding\">
2578 <ul class=\"nav nav-pills nav-stacked\">";
2581 $osVersions[] = arsort($osVersions);
2588 echo
"<li><a href=\"#\" class=\"$textcolor\">$osVersion
2589 <span class=\"pull-right $textcolor\" ><i class=\"fa fa-angle-down\"></i>$value</span></a></li>";
2612 echo
"<!-- donut box: -->
2613 <div class=\"box box-default\">
2614 <div class=\"box-header with-border\">
2615 <h3 class=\"box-title\">$lang[DEVICE_TYPE] <small>($lang[DESKTOP_MOBILE_TABLET])</small></h3>
2617 <div class=\"box-tools pull-right\">
2618 <button type=\"button\" class=\"btn btn-box-tool\" data-widget=\"collapse\"><i class=\"fa fa-minus\"></i>
2620 <button type=\"button\" class=\"btn btn-box-tool\" data-widget=\"remove\"><i class=\"fa fa-times\"></i></button>
2623 <!-- /.box-header -->
2624 <div class=\"box-body\">
2626 <div class=\"col-md-8\">
2627 <div class=\"chart-responsive\">
2628 <canvas id=\"barChartDeviceType\" height=\"150\"></canvas>
2630 <!-- ./chart-responsive -->
2633 <div class=\"col-md-4\">
2634 <ul class=\"chart-legend clearfix\">
2642 var barChartCanvas = $('#barChartDeviceType').get(0).getContext('2d');
2643 var barChart = new Chart(barChartCanvas);
2644 barChartData.datasets.fillColor = '#00a65a';
2645 barChartData.datasets.strokeColor = '#00a65a';
2646 barChartData.datasets.pointColor = '#00a65a';
2647 var barChartOptions = {
2648 //Boolean - Whether the scale should start at zero, or an order of magnitude down from the lowest value
2649 scaleBeginAtZero: true,
2650 //Boolean - Whether grid lines are shown across the chart
2651 scaleShowGridLines: true,
2652 //String - Colour of the grid lines
2653 scaleGridLineColor: 'rgba(0,0,0,.05)',
2654 //Number - Width of the grid lines
2655 scaleGridLineWidth: 1,
2656 //Boolean - Whether to show horizontal lines (except X axis)
2657 scaleShowHorizontalLines: true,
2658 //Boolean - Whether to show vertical lines (except Y axis)
2659 scaleShowVerticalLines: true,
2660 //Boolean - If there is a stroke on each bar
2661 barShowStroke: true,
2662 //Number - Pixel width of the bar stroke
2664 //Number - Spacing between each of the X value sets
2666 //Number - Spacing between data sets within X values
2667 barDatasetSpacing: 1,
2668 //String - A legend template
2669 legendTemplate: '<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets.fillColor %>\"></span><%if(datasets[i].label){%><%=datasets.label%><%}%></li><%}%></ul>',
2670 //Boolean - whether to make the chart responsive
2672 maintainAspectRatio: true
2675 barChartOptions.datasetFill = false;
2676 barChart.Bar(barChartData, barChartOptions);
2688 echo
"<li><i class=\"fa fa-circle-o $textcolor\"></i> <b>$value</b> $deviceType</li>";
2693 echo
"<li class=\"small\">$lang[LATEST] $value $lang[USERS]</li>";
2705 <div class=\"box-footer no-padding\">
2706 <ul class=\"nav nav-pills nav-stacked\">";
2709 if (is_array($deviceTypes) && (!empty($deviceTypes)))
2711 $deviceTypes[] = arsort($deviceTypes);
2718 echo
"<li><a href=\"#\" class=\"$textcolor\">$deviceType
2719 <span class=\"pull-right $textcolor\" ><i class=\"fa fa-angle-down\"></i>$value</span></a></li>";
2739 public function drawLoginBox(
$db,
$lang)
2744 echo
"<!-- donut box: -->
2745 <div class=\"box box-default\">
2746 <div class=\"box-header with-border\">
2747 <h3 class=\"box-title\">$lang[LOGINS] <small>$lang[OVERVIEW_LOGINS]</small></h3>
2749 <div class=\"box-tools pull-right\">
2750 <button type=\"button\" class=\"btn btn-box-tool\" data-widget=\"collapse\"><i class=\"fa fa-minus\"></i>
2752 <button type=\"button\" class=\"btn btn-box-tool\" data-widget=\"remove\"><i class=\"fa fa-times\"></i></button>
2755 <!-- /.box-header -->
2756 <div class=\"box-body\">
2758 <div class=\"col-md-8\">
2759 <div class=\"chart-responsive\">
2760 <canvas id=\"pieChartLogins\" height=\"150\"></canvas>
2762 <!-- ./chart-responsive -->
2765 <div class=\"col-md-4\">
2766 <ul class=\"chart-legend clearfix\">
2768 <script> //-------------
2772 // Get context with jQuery - using jQuery's .get() method.
2773 var pieChartCanvas = $('#pieChartLogins').get(0).getContext('2d');
2774 var pieChart = new Chart(pieChartCanvas);
2775 // get browsers array
2776 // output js data with php function getJsonBrowsers
2780 //Boolean - Whether we should show a stroke on each segment
2781 segmentShowStroke: true,
2782 //String - The colour of each segment stroke
2783 segmentStrokeColor: '#fff',
2784 //Number - The width of each segment stroke
2785 segmentStrokeWidth: 1,
2786 //Number - The percentage of the chart that we cut out of the middle
2787 percentageInnerCutout: 50, // This is 0 for Pie charts
2788 //Number - Amount of animation steps
2789 animationSteps: 100,
2790 //String - Animation easing effect
2791 animationEasing: 'easeOutBounce',
2792 //Boolean - Whether we animate the rotation of the Doughnut
2793 animateRotate: true,
2794 //Boolean - Whether we animate scaling the Doughnut from the centre
2795 animateScale: false,
2796 //Boolean - whether to make the chart responsive to window resizing
2798 // Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container
2799 maintainAspectRatio: false,
2800 //String - A legend template
2801 legendTemplate: '<ul class=\"<%=name.toLowerCase() %>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor %>\"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>',
2802 //String - A tooltip template
2803 tooltipTemplate: '<%=value %> <%=label%>'
2805 //Create pie or douhnut chart
2806 // You can switch between pie and douhnut using the method below.
2807 pieChart.Doughnut(PieData, pieOptions);
2810 //-----------------</script>";
2813 foreach ($logins AS $login =>
$value)
2817 if (
$value > 0 && ($login !==
"Total") && ($login ===
"FailedPercentage") || ($login ===
"SuccessPercentage"))
2819 if ($login ===
"FailedPercentage") { $login =
$lang[
'FAILED']; }
2820 if ($login ===
"SuccessPercentage") { $login =
$lang[
'SUCCESSFUL']; }
2821 echo
"<li><i class=\"fa fa-circle-o $textcolor\"></i> <b>$value%</b> $login</li>";
2824 if ($login ===
"Total")
2826 echo
"<li class=\"small\">$lang[LATEST] $value $lang[LOGINS]</li>";
2837 <div class=\"box-footer no-padding\">
2838 <ul class=\"nav nav-pills nav-stacked\">";
2841 $logins[] = arsort($logins);
2843 foreach ($logins as $login =>
$value)
2845 if (
$value !== 0 && $login !== 0)
2848 if ($login !==
"Failed"
2849 && ($login !==
"Successful")
2850 && ($login !==
"Total"))
2852 $spacer =
" <small>";
2853 $spacerEnd =
"</small>";
2860 if ($login !==
"FailedPercentage" && ($login !==
"SuccessPercentage"))
2862 echo
"<li><a href=\"#\" class=\"$textcolor\">$spacer$login$spacerEnd
2863 <span class=\"pull-right $textcolor\" ><i class=\"fa fa-angle-down\"></i>$value</span></a></li>";
2890 echo
"<!-- donut box: -->
2891 <div class=\"box box-default\">
2892 <div class=\"box-header with-border\">
2893 <h3 class=\"box-title\">$lang[DAYTIME] <small>$lang[PRIMETIME_QUESTION]</small></h3>
2895 <div class=\"box-tools pull-right\">
2896 <button type=\"button\" class=\"btn btn-box-tool\" data-widget=\"collapse\"><i class=\"fa fa-minus\"></i>
2898 <button type=\"button\" class=\"btn btn-box-tool\" data-widget=\"remove\"><i class=\"fa fa-times\"></i></button>
2901 <!-- /.box-header -->
2902 <div class=\"box-body\">
2904 <div class=\"col-md-8\">
2905 <div class=\"chart-responsive\">
2906 <canvas id=\"pieChartDaytime\" height=\"150\"></canvas>
2907 </div><!-- ./chart-responsive -->
2909 <div class=\"chart-responsive\">
2910 <canvas id=\"barChartDaytime\" height=\"150\"></canvas>
2911 </div><!-- ./chart-responsive -->
2914 <div class=\"chart-responsive\">
2915 <canvas id=\"lineChartDaytime\" height=\"150\"></canvas>
2916 </div><!-- ./chart-responsive
2920 <div class=\"col-md-4\">
2921 <ul class=\"chart-legend clearfix\">
2928 // Get context with jQuery - using jQuery's .get() method.
2929 var pieChartCanvas = $('#pieChartDaytime').get(0).getContext('2d');
2930 var pieChart = new Chart(pieChartCanvas);
2931 // get browsers array
2932 // output js data with php function getJsonBrowsers
2936 //Boolean - Whether we should show a stroke on each segment
2937 segmentShowStroke: true,
2938 //String - The colour of each segment stroke
2939 segmentStrokeColor: '#fff',
2940 //Number - The width of each segment stroke
2941 segmentStrokeWidth: 1,
2942 //Number - The percentage of the chart that we cut out of the middle
2943 percentageInnerCutout: 0, // This is 0 for Pie charts
2944 //Number - Amount of animation steps
2945 animationSteps: 100,
2946 //String - Animation easing effect
2947 animationEasing: 'easeOutBounce',
2948 //Boolean - Whether we animate the rotation of the Doughnut
2949 animateRotate: true,
2950 //Boolean - Whether we animate scaling the Doughnut from the centre
2951 animateScale: false,
2952 //Boolean - whether to make the chart responsive to window resizing
2954 // Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container
2955 maintainAspectRatio: false,
2956 //String - A legend template
2957 legendTemplate: '<ul class=\" <%=name.toLowerCase() %>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor %>\"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>',
2958 //String - A tooltip template
2959 tooltipTemplate: '<%=value %> <%=label%>'
2961 //Create pie or douhnut chart
2962 // You can switch between pie and douhnut using the method below.
2963 pieChart.Doughnut(PieData, pieOptions);
2976 var barChartCanvas = $('#barChartDaytime').get(0).getContext('2d');
2977 var barChart = new Chart(barChartCanvas);
2978 barChartData.datasets.fillColor = '#00a65a';
2979 barChartData.datasets.strokeColor = '#00a65a';
2980 barChartData.datasets.pointColor = '#00a65a';
2981 var barChartOptions = {
2982 //Boolean - Whether the scale should start at zero, or an order of magnitude down from the lowest value
2983 scaleBeginAtZero: true,
2984 //Boolean - Whether grid lines are shown across the chart
2985 scaleShowGridLines: true,
2986 //String - Colour of the grid lines
2987 scaleGridLineColor: 'rgba(0,0,0,.05)',
2988 //Number - Width of the grid lines
2989 scaleGridLineWidth: 1,
2990 //Boolean - Whether to show horizontal lines (except X axis)
2991 scaleShowHorizontalLines: true,
2992 //Boolean - Whether to show vertical lines (except Y axis)
2993 scaleShowVerticalLines: true,
2994 //Boolean - If there is a stroke on each bar
2995 barShowStroke: true,
2996 //Number - Pixel width of the bar stroke
2998 //Number - Spacing between each of the X value sets
3000 //Number - Spacing between data sets within X values
3001 barDatasetSpacing: 1,
3002 //String - A legend template
3003 legendTemplate: '<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets.fillColor %>\"></span><%if(datasets[i].label){%><%=datasets.label%><%}%></li><%}%></ul>',
3004 //Boolean - whether to make the chart responsive
3006 maintainAspectRatio: true
3009 barChartOptions.datasetFill = false;
3010 barChart.Bar(barChartData, barChartOptions);
3015 //------------------
3017 //------------------
3019 var lineChartOptions = {
3020 //Boolean - If we should show the scale at all
3022 //Boolean - Whether grid lines are shown across the chart
3023 scaleShowGridLines: false,
3024 //String - Colour of the grid lines
3025 scaleGridLineColor: 'rgba(0, 0, 0, .05)',
3026 //Number - Width of the grid lines
3027 scaleGridLineWidth: 1,
3028 //Boolean - Whether to show horizontal lines (except X axis)
3029 scaleShowHorizontalLines: true,
3030 //Boolean - Whether to show vertical lines (except Y axis)
3031 scaleShowVerticalLines: true,
3032 //Boolean - Whether the line is curved between points
3034 //Number - Tension of the bezier curve between points
3035 bezierCurveTension: 0.3,
3036 //Boolean - Whether to show a dot for each point
3038 //Number - Radius of each point dot in pixels
3040 //Number - Pixel width of point dot stroke
3041 pointDotStrokeWidth: 1,
3042 //Number - amount extra to add to the radius to cater for hit detection outside the drawn point
3043 pointHitDetectionRadius: 20,
3044 //Boolean - Whether to show a stroke for datasets
3045 datasetStroke: true,
3046 //Number - Pixel width of dataset stroke
3047 datasetStrokeWidth: 2,
3048 //Boolean - Whether to fill the dataset with a color
3050 //String - A legend template
3051 legendTemplate: '<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].lineColor %>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>',
3052 //Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container
3053 maintainAspectRatio: true,
3054 //Boolean - whether to make the chart responsive to window resizing
3058 // Create the line chart
3059 lineChart.Line(lineChartData, lineChartOptions);
3060 var lineChartCanvas = $('#lineChartDaytime').get(0).getContext('2d');
3061 var lineChart = new Chart(lineChartCanvas);
3062 lineChartOptions.datasetFill = false;
3063 lineChart.Line(lineChartData, lineChartOptions);
3068 if ($dayTimesPercent)
3070 foreach ($dayTimesPercent AS $daytime =>
$value)
3074 if (
$value > 0 && ($daytime !==
"$lang[TOTAL]"))
3076 $spacer =
" ";
3077 if ($daytime ===
"$lang[MORNING]")
3078 { $legend =
"$spacer<small>06:00 - 11:00</small>"; }
3079 elseif ($daytime ===
"$lang[AFTERNOON]")
3080 { $legend =
"$spacer<small>12:00 - 17:00</small>"; }
3081 elseif ($daytime ===
"$lang[EVENING]")
3082 { $legend =
"$spacer<small>18:00 - 23:00</small>"; }
3083 elseif ($daytime ===
"$lang[NIGHT]")
3084 { $legend =
"$spacer<small>00:00 - 05:00</small>"; }
3085 else { $legend =
''; }
3086 echo
"<li><i class=\"fa fa-circle-o $textcolor\"></i> <b>$value%</b> $daytime <br><small>$legend</small></li>";
3089 if ($daytime ===
"Total")
3091 echo
"<li class=\"small\">latest $value hits</li>";
3103 <div class=\"box-footer no-padding\">
3104 <ul class=\"nav nav-pills nav-stacked\">";
3107 $dayTimes[] = arsort($dayTimes);
3109 foreach ($dayTimes as $dayTime =>
$value)
3111 if (
$value !== 0 && $dayTime !== 0)
3114 echo
"<li><a href=\"#\" class=\"$textcolor\">$dayTime
3115 <span class=\"pull-right $textcolor\" ><i class=\"fa fa-angle-down\"></i>$value</span></a></li>";
3146 $heading =
"$lang[THE_LATEST] $limit $lang[DAYS]";
3149 echo
"<!-- donut box: -->
3150 <div class=\"box box-default\">
3151 <div class=\"box-header with-border\">
3152 <h3 class=\"box-title\">$lang[WEEKDAYS] <small>$lang[WEEKDAY_OVERVIEW] $heading</small></h3>
3154 <div class=\"box-tools pull-right\">
3155 <button type=\"button\" class=\"btn btn-box-tool\" data-widget=\"collapse\"><i class=\"fa fa-minus\"></i>
3157 <button type=\"button\" class=\"btn btn-box-tool\" data-widget=\"remove\"><i class=\"fa fa-times\"></i></button>
3160 <!-- /.box-header -->
3161 <div class=\"box-body\">
3163 <div class=\"col-md-8\">
3164 <div class=\"chart-responsive\">
3165 <canvas id=\"barChartWeekdays\" height=\"150\"></canvas>
3167 <!-- ./chart-responsive -->
3170 <div class=\"col-md-4\">
3171 <ul class=\"chart-legend clearfix\">
3179 var barChartCanvas = $('#barChartWeekdays').get(0).getContext('2d');
3180 var barChart = new Chart(barChartCanvas);
3181 barChartData.datasets.fillColor = '#00a65a';
3182 barChartData.datasets.strokeColor = '#00a65a';
3183 barChartData.datasets.pointColor = '#00a65a';
3184 var barChartOptions = {
3185 //Boolean - Whether the scale should start at zero, or an order of magnitude down from the lowest value
3186 scaleBeginAtZero: true,
3187 //Boolean - Whether grid lines are shown across the chart
3188 scaleShowGridLines: true,
3189 //String - Colour of the grid lines
3190 scaleGridLineColor: 'rgba(0,0,0,.05)',
3191 //Number - Width of the grid lines
3192 scaleGridLineWidth: 1,
3193 //Boolean - Whether to show horizontal lines (except X axis)
3194 scaleShowHorizontalLines: true,
3195 //Boolean - Whether to show vertical lines (except Y axis)
3196 scaleShowVerticalLines: true,
3197 //Boolean - If there is a stroke on each bar
3198 barShowStroke: true,
3199 //Number - Pixel width of the bar stroke
3201 //Number - Spacing between each of the X value sets
3203 //Number - Spacing between data sets within X values
3204 barDatasetSpacing: 1,
3205 //String - A legend template
3206 legendTemplate: '<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets.fillColor %>\"></span><%if(datasets[i].label){%><%=datasets.label%><%}%></li><%}%></ul>',
3207 //Boolean - whether to make the chart responsive
3209 maintainAspectRatio: true
3212 barChartOptions.datasetFill = false;
3213 barChart.Bar(barChartData, barChartOptions);
3215 if ($weekdaysPercent)
3218 foreach ($weekdaysPercent AS $weekday =>
$value)
3221 if (
$value > 0 && ($weekday !==
"$lang[TOTAL]"))
3223 if (strlen(
$value) === 1) { $spacer =
" "; }
else { $spacer =
''; }
3224 echo
"<li><b>$spacer$value%</b> $weekday</li>";
3227 if ($weekday ===
"Total")
3229 echo
"<li class=\"small\">latest $value hits</li>";
3253 <div class=\"col-md-12\">
3256 <div class=\"box-header with-border\">
3257 <h3 class=\"box-title\">$lang[STATS] <small>$lang[HITS_AND_USER_BEHAVIOR] </small></h3>
3259 <div class=\"box-body\">";
3260 $this->i_hits = number_format($this->i_hits, 0,
'.',
'.');
3262 echo
"$lang[ACTIVE_SESSIONS]: <b>$this->currentOnline</b><br>
3263 $lang[HITS] $lang[OVERALL]:<b> $this->i_hits</b><br>
3264 $lang[GUESTS]: <b> $this->i_publicUsersPercentage</b> % <small>($this->i_publicUsers)</small><br>
3265 $lang[MEMBERS]: <b> $this->i_loggedUsersPercentage</b> % <small>($this->i_loggedUsers)</small><br>
3283 <div class=\"box-header with-border\">
3284 <h3 class=\"box-title\">$lang[PAGE_VIEWS] <small> $lang[HITS_FROM_MOST_TO_LEAST]</small></h3>
3287 if (is_array(
$data))
3298 echo
"<div class=\"box-footer no-padding\">
3299 <ul class=\"nav nav-pills nav-stacked\">";
3306 echo
"<li><a href=\"../$page\" target=\"_blank\"><b>$value</b> <span class=\"text-blue\">$page</span></a></li>";
3320 echo
"<div class=\"box\">";
3321 echo
"<div class=\"box-header\"><h3 class=\"box-title\">$lang[DAYS_OF_MONTH]</h3></div>";
3322 echo
"<div class=\"box-body\">";
3324 $daysOfMonth =
date(
"t",mktime(0, 0, 0, 9, 1, 2017));
3326 for(
$i = 1;
$i < $daysOfMonth;
$i++){
print $lang['FILEMAN_UPLOAD']
if(!isset($language)||(!isset($lang))) $item
static draw($type, $title, $text, $redirect, $delay)
The default pages class. Provide all functions to handle static pages.
static getSetting($db, $property)
Get and return value for property from settings database.
Statistics - get and set user and page stats.
countWeekdays($db, $data, $lang, $limit)
Count and set the number of hits for each weekday.
setStats($db)
Insert statistics data into database.
getDaytimeColors($daytime, $lang)
Set and return the legend textcolor for each daytime.
getJsonDeviceTypes($db, $deviceTypes, $lang)
Output JS: BAR CHART device types.
countLogins($db)
Count system logins.
getUserStats($db)
Count and set user stats like, how many users are registered, currently online or blocked.
getLoginColors($login)
Set and return the legend textcolor for logins (failed | success)
getJsonDaytimePieChart($db, $daytimes, $lang)
Output JS: PIE CHART daytime data.
calculateStatsFromArray($db, $data)
Calculate some basic stats (almost outdated)
getDaysOfMonthBox($lang)
Draw default box containing days of month statistics.
drawOverviewBox($lang)
Draw default box containing overview statistics.
getOnlineUsers($db)
Return the number of all currently online users.
getDeviceTypeColors($deviceType)
Set and return the legend textcolor for each device type.
countMessages($db)
Count all messages that are stored in the database.
insertData($db)
Insert data into database.
getOsColors($os)
Set and return the legend textcolor for each operating system.
countDaytime($db, $data, $lang)
Count and set the number of hits for each daytime.
drawUserStats($db, $lang)
Draw a default box containing user statistics.
$i_loginSuccessPercentage
setOnlineUsers($db)
Set users online in database (stores and check sessions and timestamps)
getJsonWeekdayBarChart($lang)
Output JS: WEEKDAY BAR CHART.
countDeviceTypes($db, $data)
Count device types (desktop, phone or tablet)
getDayTimesPercent($lang)
Calculate hits per daytime and return data in percent.
drawPagesBox($data, $lang)
Draw default box containing pages statistics.
countOS($db, $data)
Count operating systems.
getWeekdaysPercent($lang)
Calculate hits in percent for each weekday.
getBrowserColors($browser)
Set and return the legend textcolor for each browser.
getStatsArray($db, $interval, $period)
Returns an array with all stats, ordered by date_created.
prepareData()
Prepare data: get and collect, detect OS and device type.
getOsVersionsColors($osVersions)
Set and return the legend textcolor for each OS Version.
countOSVersions($db, $data)
Count operating systems versions.
getJsonDaytimeLineChart($db, $daytimes, $lang)
Output JS: LINE CHART daytime data.
countBrowsers($db, $data)
Count and return browsers.
getJsonDaytimeBarChart($db, $daytimes, $lang)
Output JS: BAR CHART daytime data.
getJsonOS($db, $oss)
Output JS: PIE CHART OS data.
getJsonBrowsers($db, $browsers)
Output JS: PIE CHART browser data.
getJsonLogins($db, $logins, $lang)
Output JS: PIE CHART login data.
getJsonOSVersions($db, $osVersions)
Output JS: BAR CHART OS versions.
deleteOutdatedSessions($db)
Check and delete outdated sessions if they are expired.
static getWeekday($date, $lang)
return weekday from given date
static getBrowser($useragent)
extract browser from useragent
static getOS($useragent)
get operating system from useragent string
static now()
returns the current datetime
return window window jQBrowser a &&a browser
This class serves methods to create backup from files.