getAuthCanViewChart() == 0) { // list all channels if (User::isAdmin()) { if(empty($_REQUEST['users_id'])){ $users_id = 'all'; }else{ $users_id = $_REQUEST['users_id']; } } elseif (User::isLogged()) { $users_id = User::getId(); } } elseif ($config->getAuthCanViewChart() == 1) { if ((!empty($_SESSION['user']['canViewChart']))||(User::isAdmin())) { if(empty($_REQUEST['users_id'])){ $users_id = 'all'; }else{ $users_id = $_REQUEST['users_id']; } } } $obj = new stdClass(); $obj->data = []; if(empty($users_id)){ die(json_encode($obj)); } if($users_id === 'all'){ $users_id = 0; } $obj->data = VideoStatistic::getStatisticTotalViewsAndSecondsWatchingFromUser($users_id, $from, $to); echo json_encode($obj);