1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00
Oinktube/view/videoViewsInfo.json.php
Daniel 2a9630258f https://github.com/WWBN/AVideo/issues/6345#issuecomment-1067056556
Also check the lang in case insensitive
2022-03-14 14:28:38 -03:00

26 lines
No EOL
867 B
PHP

<?php
require_once '../videos/configuration.php';
header('Content-Type: application/json');
if (!empty($_REQUEST['hash'])) {
$string = decryptString($_REQUEST['hash']);
$obj = json_decode($string);
$videos_id = intval($obj->videos_id);
} else {
$videos_id = intval(@$_REQUEST['videos_id']);
if (!Video::canEdit($videos_id)) {
forbiddenPage("You cannot see this info");
}
}
if (empty($videos_id)) {
forbiddenPage("Videos ID is required");
}
$rowsCount = getRowCount();
$rows = VideoStatistic::getAllFromVideos_id($videos_id);
$total = VideoStatistic::getTotalFromVideos_id($videos_id);
$totalPages = ceil($total / $rowsCount);
?>
{"data": <?php echo json_encode($rows); ?>, "draw": <?php echo intval(@$_REQUEST['draw']); ?>, "recordsTotal":<?php echo $total; ?>, "recordsFiltered":<?php echo $total; ?>}