1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00
Oinktube/objects/playlistsFromUserVideos.json.php
2023-10-16 17:58:47 -03:00

31 lines
No EOL
1,000 B
PHP

<?php
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: Content-Type');
header('Content-Type: application/json');
if (empty($_REQUEST['users_id'])) {
forbiddenPage('You need a user');
}
if (session_status() !== PHP_SESSION_NONE) {
_session_write_close();
}
require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once './playlist.php';
header('Content-Type: application/json');
//mysqlBeginTransaction();
if (is_array($_REQUEST['videos_id'])) {
$rows = [];
foreach ($_REQUEST['videos_id'] as $value) {
$rows[] = ['videos_id' => $value, 'playlists' => PlayList::getAllFromUserVideo($_REQUEST['users_id'], $value, false)];
}
echo json_encode($rows);
} else {
$row = PlayList::getAllFromUserVideo($_REQUEST['users_id'], $_REQUEST['videos_id'], false);
echo json_encode($row);
}
//mysqlCommit();