diff --git a/view/charts_head.php b/view/charts_head.php index 60b4881df..a33bfb0f9 100644 --- a/view/charts_head.php +++ b/view/charts_head.php @@ -1,192 +1,192 @@ getAuthCanViewChart() == 0) { if (User::isAdmin()) { - $videos = Video::getAllVideosAsync("viewable", true, true, array(), true); + $videos = Video::getAllVideos("viewable", true, true, array(), true); $times[__LINE__] = microtime(true) - $start; $start = microtime(true); $totalVideos = Video::getTotalVideos("viewable"); $times[__LINE__] = microtime(true) - $start; $start = microtime(true); $totalUsers = User::getTotalUsers(); $times[__LINE__] = microtime(true) - $start; $start = microtime(true); $totalSubscriptions = Subscribe::getTotalSubscribes(); $times[__LINE__] = microtime(true) - $start; $start = microtime(true); $totalComents = Comment::getTotalComments(); $times[__LINE__] = microtime(true) - $start; $start = microtime(true); unset($_POST['rowCount']); $totalInfos = Video::getTotalVideosInfoAsync("viewable", false, false, array(), false); $times[__LINE__] = microtime(true) - $start; $start = microtime(true); } else { - $videos = Video::getAllVideosAsync("viewable", true, true, array(), true); + $videos = Video::getAllVideos("viewable", true, true, array(), true); $times[__LINE__] = microtime(true) - $start; $start = microtime(true); $totalVideos = Video::getTotalVideos("", true); $times[__LINE__] = microtime(true) - $start; $start = microtime(true); $totalUsers = User::getTotalUsers(); $times[__LINE__] = microtime(true) - $start; $start = microtime(true); $totalSubscriptions = Subscribe::getTotalSubscribes(User::getId()); $times[__LINE__] = microtime(true) - $start; $start = microtime(true); $totalComents = Comment::getTotalComments(0, 'NULL', User::getId()); $times[__LINE__] = microtime(true) - $start; $start = microtime(true); unset($_POST['rowCount']); $totalInfos = Video::getTotalVideosInfoAsync("", true, false, array(), false); $times[__LINE__] = microtime(true) - $start; $start = microtime(true); } } else if ($config->getAuthCanViewChart() == 1) { // mode 1 means selected users see admin-charts. if ((!empty($_SESSION['user']['canViewChart'])) || (User::isAdmin())) { - $videos = Video::getAllVideosAsync("viewable", true, true, array(), false); + $videos = Video::getAllVideos("viewable", true, true, array(), false); $times[__LINE__] = microtime(true) - $start; $start = microtime(true); $totalVideos = Video::getTotalVideos("viewable"); $times[__LINE__] = microtime(true) - $start; $start = microtime(true); $totalUsers = User::getTotalUsers(true); $times[__LINE__] = microtime(true) - $start; $start = microtime(true); $totalSubscriptions = Subscribe::getTotalSubscribes(true); $times[__LINE__] = microtime(true) - $start; $start = microtime(true); $totalComents = Comment::getTotalComments(true); $times[__LINE__] = microtime(true) - $start; $start = microtime(true); unset($_POST['rowCount']); $totalInfos = Video::getTotalVideosInfoAsync("viewable", false, false, array(), false); $times[__LINE__] = microtime(true) - $start; $start = microtime(true); } else { forbiddenPage("You have no access here!"); } } $labelToday = array(); for ($i = 0; $i < 24; $i++) { $labelToday[] = "{$i} h"; } $label7Days = array(); for ($i = 7; $i >= 0; $i--) { $label7Days[] = date("Y-m-d", strtotime("-{$i} days")); } $label30Days = array(); for ($i = 30; $i >= 0; $i--) { $label30Days[] = date("Y-m-d", strtotime("-{$i} days")); } $label90Days = array(); for ($i = 90; $i >= 0; $i--) { $label90Days[] = date("Y-m-d", strtotime("-{$i} days")); } $statistc_lastToday = VideoStatistic::getTotalTodayAsync(""); $times[__LINE__] = microtime(true) - $start; $start = microtime(true); $statistc_last7Days = VideoStatistic::getTotalLastDaysAsync("", 7); $times[__LINE__] = microtime(true) - $start; $start = microtime(true); $statistc_last30Days = VideoStatistic::getTotalLastDaysAsync("", 30); $times[__LINE__] = microtime(true) - $start; $start = microtime(true); $statistc_last90Days = VideoStatistic::getTotalLastDaysAsync("", 90); $times[__LINE__] = microtime(true) - $start; $start = microtime(true); $bg = $bc = $labels = $labelsFull = $datas = $datas7 = $datas30 = $datasToday = $datasUnique = array(); foreach ($videos as $value) { $value = (array) $value; $labelsFull[] = xss_esc($value["title"]); $labels[] = substr(xss_esc($value["title"]), 0, 20); $datas[] = $value["statistc_all"]; $datasToday[] = $value["statistc_today"]; $datas7[] = $value["statistc_week"]; $datas30[] = $value["statistc_month"]; $datasUnique[] = $value["statistc_unique_user"]; $r = rand(0, 255); $g = rand(0, 255); $b = rand(0, 255); $bg[] = "rgba({$r}, {$g}, {$b}, 0.5)"; $bc[] = "rgba({$r}, {$g}, {$b}, 1)"; } $times[__LINE__] = microtime(true) - $start; $start = microtime(true); arsort($times); ?> \ No newline at end of file