1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 09:49:28 +02:00
DanieL 2022-09-29 18:06:28 -03:00
parent 1bb86c36ee
commit 5652b5d982

View file

@ -1,4 +1,5 @@
<?php <?php
//header("Content-Type: application/rss+xml; charset=UTF8"); //header("Content-Type: application/rss+xml; charset=UTF8");
@ -29,32 +30,35 @@ if (!empty($_GET['channelName'])) {
$title = User::getNameIdentificationById($user['id']); $title = User::getNameIdentificationById($user['id']);
$about = User::getDescriptionById($user['id'], true); $about = User::getDescriptionById($user['id'], true);
$author = $user['email']; $author = $user['email'];
if(!isHTMLEmpty($about)){ if (!isHTMLEmpty($about)) {
$description = $about; $description = $about;
} }
$link = User::getChannelLink($user['id']); $link = User::getChannelLink($user['id']);
$logo = User::getPhoto($user['id']); $logo = User::getPhoto($user['id']);
} }
if(empty($description)){ $cacheName = "feedCache" . md5(json_encode($_REQUEST));
$description = $title;
}
$cacheName = "feedCache".json_encode($_GET);
$rows = ObjectYPT::getCache($cacheName, 0); $rows = ObjectYPT::getCache($cacheName, 0);
if (empty($rows)) { if (empty($rows)) {
// send $_GET['catName'] to be able to filter by category // send $_GET['catName'] to be able to filter by category
$sort = @$_POST['sort']; $sort = @$_POST['sort'];
if(empty($_REQUEST['program_id'])){ if (empty($_REQUEST['program_id'])) {
if(empty($_POST['sort'])){ if (empty($_POST['sort'])) {
$_POST['sort'] = array('created'=>'DESC'); $_POST['sort'] = array('created' => 'DESC');
} }
$rows = Video::getAllVideos("viewable", $showOnlyLoggedUserVideos); $rows = Video::getAllVideos("viewable", $showOnlyLoggedUserVideos);
}else{ } else {
unset($_POST['sort']); unset($_POST['sort']);
$videosArrayId = PlayList::getVideosIdFromPlaylist($_REQUEST['program_id']); $playlists_id = intval($_REQUEST['program_id']);
$pl = new PlayList($playlists_id);
$videosArrayId = PlayList::getVideosIdFromPlaylist($playlists_id);
$rows = Video::getAllVideos("viewable", false, true, $videosArrayId, false, true); $rows = Video::getAllVideos("viewable", false, true, $videosArrayId, false, true);
$rows = PlayList::sortVideos($rows, $videosArrayId); $rows = PlayList::sortVideos($rows, $videosArrayId);
$title = PlayLists::getNameOrSerieTitle($playlists_id);
$link = PlayLists::getLink($playlists_id);
$users_id = $pl->getUsers_id();
$author = User::getEmailDb($users_id);
$description = PlayLists::getDescriptionIfIsSerie($playlists_id);
//var_dump($videosArrayId);foreach ($rows as $value) {var_dump($value['id']);}exit; //var_dump($videosArrayId);foreach ($rows as $value) {var_dump($value['id']);}exit;
} }
$_POST['sort'] = $sort; $_POST['sort'] = $sort;
@ -62,6 +66,27 @@ if (empty($rows)) {
} else { } else {
$rows = object_to_array($rows); $rows = object_to_array($rows);
} }
if (!empty($_REQUEST['program_id'])) {
$playlists_id = intval($_REQUEST['program_id']);
$pl = new PlayList($playlists_id);
$videosArrayId = PlayList::getVideosIdFromPlaylist($playlists_id);
$title = PlayLists::getNameOrSerieTitle($playlists_id);
$link = PlayLists::getLink($playlists_id);
$users_id = $pl->getUsers_id();
$new_author = User::getEmailDb($users_id);
if(!empty($new_author)){
$author = $new_author;
}
$description = PlayLists::getDescriptionIfIsSerie($playlists_id);
//var_dump($videosArrayId);foreach ($rows as $value) {var_dump($value['id']);}exit;
}
if (empty($description)) {
$description = $title;
}
//var_dump($title, $cacheName, $_REQUEST);exit;
if (!empty($_REQUEST['roku'])) { if (!empty($_REQUEST['roku'])) {
include $global['systemRootPath'] . 'feed/roku.json.php'; include $global['systemRootPath'] . 'feed/roku.json.php';
} elseif (empty($_REQUEST['mrss'])) { } elseif (empty($_REQUEST['mrss'])) {
@ -70,6 +95,6 @@ if (!empty($_REQUEST['roku'])) {
include $global['systemRootPath'] . 'feed/mrss.php'; include $global['systemRootPath'] . 'feed/mrss.php';
} }
function feedText($text){ function feedText($text) {
return trim(str_replace(['&&'], ['&'], str_replace(['&nbsp;','&','<','>'], [' ','&amp;','&lt;','&gt;'], (strip_tags(br2nl($text)))))); return trim(str_replace(['&&'], ['&'], str_replace(['&nbsp;', '&', '<', '>'], [' ', '&amp;', '&lt;', '&gt;'], (strip_tags(br2nl($text))))));
} }