1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00

ROKU JSON from playlists

Option for each user can select what playlist newly encoded videos will be automatically added
This commit is contained in:
DanieL 2022-09-05 17:20:10 -03:00
parent cfbfd8a322
commit 73e602261b
12 changed files with 558 additions and 455 deletions

View file

@ -39,10 +39,18 @@ $rows = ObjectYPT::getCache($cacheName, 0);
if (empty($rows)) {
// send $_GET['catName'] to be able to filter by category
$sort = @$_POST['sort'];
if(empty($_POST['sort'])){
$_POST['sort'] = array('created'=>'DESC');
if(empty($_REQUEST['program_id'])){
if(empty($_POST['sort'])){
$_POST['sort'] = array('created'=>'DESC');
}
$rows = Video::getAllVideos("viewable", $showOnlyLoggedUserVideos);
}else{
unset($_POST['sort']);
$videosArrayId = PlayList::getVideosIdFromPlaylist($_REQUEST['program_id']);
$rows = Video::getAllVideos("viewable", false, true, $videosArrayId, false, true);
$rows = PlayList::sortVideos($rows, $videosArrayId);
//var_dump($videosArrayId);foreach ($rows as $value) {var_dump($value['id']);}exit;
}
$rows = Video::getAllVideos("viewable", $showOnlyLoggedUserVideos);
$_POST['sort'] = $sort;
ObjectYPT::setCache($cacheName, $rows);
} else {
@ -56,7 +64,6 @@ if (!empty($_REQUEST['roku'])) {
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))))));
}

View file

@ -27,7 +27,7 @@ class PlayList extends ObjectYPT {
protected static function getFromDbFromName($name) {
global $global;
$sql = "SELECT * FROM " . static::getTableName() . " WHERE name = ? users_id = " . User::getId() . " LIMIT 1";
$sql = "SELECT * FROM " . static::getTableName() . " WHERE name = ? AND users_id = " . User::getId() . " LIMIT 1";
$res = sqlDAL::readSql($sql, "s", [$name]);
$data = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
@ -39,6 +39,20 @@ class PlayList extends ObjectYPT {
return $row;
}
static function getFromDbFromId($id) {
global $global;
$sql = "SELECT * FROM " . static::getTableName() . " WHERE id = ? AND users_id = " . User::getId() . " LIMIT 1";
$res = sqlDAL::readSql($sql, "i", [$id]);
$data = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
if ($res) {
$row = $data;
} else {
$row = false;
}
return $row;
}
public function loadFromName($name) {
if (!User::isLogged()) {
return false;

View file

@ -2885,7 +2885,7 @@ if (typeof gtag !== \"function\") {
}
_session_start();
$_SESSION['swapUser'] = $_SESSION['user'];
$user = self::getUserDb($users_id);
$user = self::getUserFromID($users_id);
//var_dump($users_id, $user);exit;
_error_log("swapUser {$users_id}");
$_SESSION['user'] = $user;

View file

@ -1,237 +1,237 @@
<?php
require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php';
require_once $global['systemRootPath'] . 'plugin/AD_Overlay/Objects/AD_Overlay_Code.php';
class AD_Overlay extends PluginAbstract {
public function getTags() {
return array(
PluginTags::$MONETIZATION,
PluginTags::$ADS,
PluginTags::$FREE,
PluginTags::$PLAYER,
);
}
public function getDescription() {
$txt = "Display simple overlays - similar to YouTube's \"Annotations\" feature in appearance - during video playback.";
$help = "<br><small><a href='https://github.com/WWBN/AVideo/wiki/AD_Overlay-Plugin' target='__blank'><i class='fas fa-question-circle'></i> Help</a></small>";
return $txt . $help;
}
public function getName() {
return "AD_Overlay";
}
public function getUUID() {
return "ADO73225-3807-4167-ba81-0509dd280e06";
}
public function getPluginVersion() {
return "2.1";
}
public function getEmptyDataObject() {
global $global;
$obj = new stdClass();
$o = new stdClass();
$o->type = "textarea";
$o->value = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- AVideo Videos -->
<ins class="adsbygoogle"
style="display:inline-block;width:468px;height:60px"
data-ad-client="ca-pub-8404441263723333"
data-ad-slot="6092946505"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
';
$obj->adText = $o;
$o = new stdClass();
$o->type = "textarea";
$o->value = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- AVideo Videos -->
<ins class="adsbygoogle"
style="display:inline-block;width:468px;height:60px"
data-ad-client="ca-pub-8404441263723333"
data-ad-slot="6092946505"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
';
$obj->mobileAdText = $o;
//$obj->allowUsersToAddCustomText = false;
//Where to display overlays, by default. Assuming the included stylesheet is used, the following values are supported:
// "top-left", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left".
$obj->align = "bottom-left";
$obj->showBackground = true;
//bottom aligned overlays will adjust positioning when the control bar minimizes.
$obj->attachToControlBar = false;
/*
$obj->start = true;
$obj->mid25Percent = false;
$obj->mid50Percent = false;
$obj->mid75Percent = false;
$obj->end = false;
$obj->durationInSeconds = 30;
*
*/
$obj->debug = false;
//$obj->adWidth = 0;
//$obj->adHeight = 0;
$obj->allowUserAds = true;
$obj->AdminMustApproveUserAds = true;
return $obj;
}
public function getHeadCode() {
if (empty($_GET['videoName']) && empty($_GET['u']) && empty($_GET['link'])) {
return false;
}
$videos_id = getVideos_id();
$showAds = AVideoPlugin::showAds($videos_id);
if (!$showAds) {
return "";
}
$obj = $this->getDataObject();
global $global;
$style = "width: 100%;";
if (!empty($obj->adWidth) && !empty($obj->adHeight)) {
$style = "width: $obj->adWidth; height: width: $obj->adHeight;";
}
$css = '<link href="' .getCDN() . 'plugin/AD_Overlay/videojs-overlay/videojs-overlay.css" rel="stylesheet" type="text/css"/>';
$css .= '<style>#adOverlay{min-width: 640px;}.video-js .vjs-overlay-background, .video-js .vjs-overlay-no-background {
max-height: 50%;
max-width: 100%;
' . $style . '
margin-left:-5px;
overflow: hidden;
}</style>';
return $css;
}
public function getFooterCode() {
global $global, $video;
$videos_id = getVideos_id();
$showAds = AVideoPlugin::showAds($videos_id);
if (!$showAds) {
return "";
}
if (basename($_SERVER["SCRIPT_FILENAME"]) === 'managerUsers.php') {
include $global['systemRootPath'] . 'plugin/AD_Overlay/footer.php';
}
if (empty($_GET['videoName']) && empty($_GET['u']) && empty($_GET['link'])) {
return false;
}
$obj = $this->getDataObject();
if (isMobile()) {
$adText = $obj->mobileAdText->value;
} else {
$adText = $obj->adText->value;
}
if ($obj->allowUserAds) {
if (!empty($video['id'])) {
$v = Video::getVideoLight($video['id']);
$users_id = $video['users_id'];
}
if (!empty($_GET['c'])) {
$u = new User(0, $_GET['u'], false);
$users_id = $u->getBdId();
}
if (empty($users_id)) {
return '<!-- AD_Overlay users_id not detected -->';
}
$code = $this->getAdsFromUserIfActive($users_id);
if (!empty($code)) {
$adText = $code;
}
}
if (empty(trim($adText))) {
return '<!-- AD_Overlay adText not detected -->';
}
$ad = AVideoPlugin::getObjectData('ADs');
$js = '<div id="adOverlay" style="display:none;"><button class="pull-right btn" onclick="$(\'.vjs-overlay\').fadeOut();"><i class="fa fa-times"></i></button>'
. '<center>' . ADs::giveGoogleATimeout($adText) . '</center>'
. '</div>';
$js .= '<script src="' .getCDN() . 'plugin/AD_Overlay/videojs-overlay/videojs-overlay.js" type="text/javascript"></script>';
$onPlayerReady = "setTimeout(function(){
\$('#cbb').click(function() {
\$('.vjs-overlay').fadeOut();
$('#mainVideo .vjs-control-bar').removeClass('vjs-hidden');
$('#mainVideo .vjs-control-bar').addClass('vjs-fade-out');
});
},1000);
setTimeout(function(){
$('#mainVideo .vjs-control-bar').removeClass('vjs-hidden');
$('#mainVideo .vjs-control-bar').addClass('vjs-fade-out');
},3000);
player.overlay({
content: $('#adOverlay').html(),
debug: true,
showBackground:" . ($obj->showBackground ? "true" : "false") . ",
attachToControlBar:" . ($obj->attachToControlBar ? "true" : "false") . ",
overlays: [{
start: 'play',
end: 3600,
align: '{$obj->align}'
}]
});";
$js .= '<script>' . PlayerSkins::getStartPlayerJS($onPlayerReady) . '</script>';
return $js;
}
public static function profileTabName($users_id) {
global $global;
if (!User::canUpload()) {
return '';
}
include $global['systemRootPath'] . 'plugin/AD_Overlay/profileTabName.php';
}
public static function profileTabContent($users_id) {
global $global;
if (!User::canUpload()) {
return '';
}
include $global['systemRootPath'] . 'plugin/AD_Overlay/profileTabContent.php';
}
public function getUsersManagerListButton() {
$btn = "";
$obj = $this->getDataObject();
if (!empty($obj->allowUserAds)) {
$btn = '<button type="button" class="btn btn-warning btn-light btn-sm btn-xs" onclick="adsUser(\' + row.id + \');" data-row-id="right" data-toggle="tooltip" data-placement="left" title="Ad Code">Ad Code</button>';
}
return $btn;
}
private function getAdsFromUserIfActive($users_id) {
$ad = new AD_Overlay_Code(0);
$ad->loadFromUser($users_id);
if (!empty($ad->getStatus()) && $ad->getStatus() == 'a') {
return $ad->getCode();
}
return false;
}
}
<?php
require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php';
require_once $global['systemRootPath'] . 'plugin/AD_Overlay/Objects/AD_Overlay_Code.php';
class AD_Overlay extends PluginAbstract {
public function getTags() {
return array(
PluginTags::$MONETIZATION,
PluginTags::$ADS,
PluginTags::$FREE,
PluginTags::$PLAYER,
);
}
public function getDescription() {
$txt = "Display simple overlays - similar to YouTube's \"Annotations\" feature in appearance - during video playback.";
$help = "<br><small><a href='https://github.com/WWBN/AVideo/wiki/AD_Overlay-Plugin' target='__blank'><i class='fas fa-question-circle'></i> Help</a></small>";
return $txt . $help;
}
public function getName() {
return "AD_Overlay";
}
public function getUUID() {
return "ADO73225-3807-4167-ba81-0509dd280e06";
}
public function getPluginVersion() {
return "2.1";
}
public function getEmptyDataObject() {
global $global;
$obj = new stdClass();
$o = new stdClass();
$o->type = "textarea";
$o->value = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- AVideo Videos -->
<ins class="adsbygoogle"
style="display:inline-block;width:468px;height:60px"
data-ad-client="ca-pub-8404441263723333"
data-ad-slot="6092946505"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
';
$obj->adText = $o;
$o = new stdClass();
$o->type = "textarea";
$o->value = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- AVideo Videos -->
<ins class="adsbygoogle"
style="display:inline-block;width:468px;height:60px"
data-ad-client="ca-pub-8404441263723333"
data-ad-slot="6092946505"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
';
$obj->mobileAdText = $o;
//$obj->allowUsersToAddCustomText = false;
//Where to display overlays, by default. Assuming the included stylesheet is used, the following values are supported:
// "top-left", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left".
$obj->align = "bottom-left";
$obj->showBackground = true;
//bottom aligned overlays will adjust positioning when the control bar minimizes.
$obj->attachToControlBar = false;
/*
$obj->start = true;
$obj->mid25Percent = false;
$obj->mid50Percent = false;
$obj->mid75Percent = false;
$obj->end = false;
$obj->durationInSeconds = 30;
*
*/
$obj->debug = false;
//$obj->adWidth = 0;
//$obj->adHeight = 0;
$obj->allowUserAds = true;
$obj->AdminMustApproveUserAds = true;
return $obj;
}
public function getHeadCode() {
if (empty($_GET['videoName']) && empty($_GET['u']) && empty($_GET['link'])) {
return false;
}
$videos_id = getVideos_id();
$showAds = AVideoPlugin::showAds($videos_id);
if (!$showAds) {
return "";
}
$obj = $this->getDataObject();
global $global;
$style = "width: 100%;";
if (!empty($obj->adWidth) && !empty($obj->adHeight)) {
$style = "width: $obj->adWidth; height: width: $obj->adHeight;";
}
$css = '<link href="' .getCDN() . 'plugin/AD_Overlay/videojs-overlay/videojs-overlay.css" rel="stylesheet" type="text/css"/>';
$css .= '<style>#adOverlay{min-width: 640px;}.video-js .vjs-overlay-background, .video-js .vjs-overlay-no-background {
max-height: 50%;
max-width: 100%;
' . $style . '
margin-left:-5px;
overflow: hidden;
}</style>';
return $css;
}
public function getFooterCode() {
global $global, $video;
$videos_id = getVideos_id();
$showAds = AVideoPlugin::showAds($videos_id);
if (!$showAds) {
return "";
}
if (basename($_SERVER["SCRIPT_FILENAME"]) === 'managerUsers.php') {
include $global['systemRootPath'] . 'plugin/AD_Overlay/footer.php';
}
if (empty($_GET['videoName']) && empty($_GET['u']) && empty($_GET['link'])) {
return false;
}
$obj = $this->getDataObject();
if (isMobile()) {
$adText = $obj->mobileAdText->value;
} else {
$adText = $obj->adText->value;
}
if ($obj->allowUserAds) {
if (!empty($video['id'])) {
$v = Video::getVideoLight($video['id']);
$users_id = $video['users_id'];
}
if (!empty($_GET['c'])) {
$u = new User(0, $_GET['u'], false);
$users_id = $u->getBdId();
}
if (empty($users_id)) {
return '<!-- AD_Overlay users_id not detected -->';
}
$code = $this->getAdsFromUserIfActive($users_id);
if (!empty($code)) {
$adText = $code;
}
}
if (empty(trim($adText))) {
return '<!-- AD_Overlay adText not detected -->';
}
$ad = AVideoPlugin::getObjectData('ADs');
$js = '<div id="adOverlay" style="display:none;"><button class="pull-right btn" onclick="$(\'.vjs-overlay\').fadeOut();"><i class="fa fa-times"></i></button>'
. '<center>' . ADs::giveGoogleATimeout($adText) . '</center>'
. '</div>';
$js .= '<script src="' .getCDN() . 'plugin/AD_Overlay/videojs-overlay/videojs-overlay.js" type="text/javascript"></script>';
$onPlayerReady = "setTimeout(function(){
\$('#cbb').click(function() {
\$('.vjs-overlay').fadeOut();
$('#mainVideo .vjs-control-bar').removeClass('vjs-hidden');
$('#mainVideo .vjs-control-bar').addClass('vjs-fade-out');
});
},1000);
setTimeout(function(){
$('#mainVideo .vjs-control-bar').removeClass('vjs-hidden');
$('#mainVideo .vjs-control-bar').addClass('vjs-fade-out');
},3000);
player.overlay({
content: $('#adOverlay').html(),
debug: true,
showBackground:" . ($obj->showBackground ? "true" : "false") . ",
attachToControlBar:" . ($obj->attachToControlBar ? "true" : "false") . ",
overlays: [{
start: 'play',
end: 3600,
align: '{$obj->align}'
}]
});";
$js .= '<script>' . PlayerSkins::getStartPlayerJS($onPlayerReady) . '</script>';
return $js;
}
public static function profileTabName($users_id) {
global $global;
if (!User::canUpload()) {
return '';
}
include $global['systemRootPath'] . 'plugin/AD_Overlay/profileTabName.php';
}
public static function profileTabContent($users_id) {
global $global;
if (!User::canUpload()) {
return '';
}
include $global['systemRootPath'] . 'plugin/AD_Overlay/profileTabContent.php';
}
public function getUsersManagerListButton() {
$btn = "";
$obj = $this->getDataObject();
if (!empty($obj->allowUserAds)) {
$btn = '<button type="button" class="btn btn-warning btn-light btn-sm btn-xs" onclick="adsUser(\' + row.id + \');" data-row-id="right" data-toggle="tooltip" data-placement="left" title="Ad Code">Ad Code</button>';
}
return $btn;
}
private function getAdsFromUserIfActive($users_id) {
$ad = new AD_Overlay_Code(0);
$ad->loadFromUser($users_id);
if (!empty($ad->getStatus()) && $ad->getStatus() == 'a') {
return $ad->getCode();
}
return false;
}
}

View file

@ -9,7 +9,6 @@ if (empty($video->getIsSuggested())) {
class="suggestBtn <?php echo $_class; ?> <?php echo $class; ?>"
onclick="toogleVideoSuggested($(this));return false;"
videos_id="<?php echo $videos_id; ?>" >
<span class="hidden-md hidden-sm hidden-xs">
<span class="unsuggestText btnText"><i class="fas fa-star"></i> <?php echo __("Unsuggest it"); ?></span>
<span class="suggestText btnText"><i class="far fa-star"></i> <?php echo __("Suggest it"); ?></span></span>
<span class="unsuggestText btnText"><i class="fas fa-star"></i> <span class="hidden-md hidden-sm hidden-xs"><?php echo __("Unsuggest it"); ?></span></span>
<span class="suggestText btnText"><i class="far fa-star"></i> <span class="hidden-md hidden-sm hidden-xs"><?php echo __("Suggest it"); ?></span></span>
</button>

View file

@ -131,7 +131,7 @@ class PlayLists extends PluginAbstract {
if (!empty(getPlaylists_id()) && isEmbed()) {
PlayerSkins::getStartPlayerJS(file_get_contents("{$global['systemRootPath']}plugin/PlayLists/playerButton.js"));
}
return $js;
}
@ -255,7 +255,7 @@ class PlayLists extends PluginAbstract {
}
}
static function getLink($playlists_id, $embed = false, $playlist_index=null) {
static function getLink($playlists_id, $embed = false, $playlist_index = null) {
global $global;
$obj = AVideoPlugin::getObjectData("PlayLists");
if ($embed) {
@ -267,7 +267,7 @@ class PlayLists extends PluginAbstract {
$url = $global['webSiteRootURL'] . "program/" . $playlists_id;
}
}
if(isset($playlist_index)){
if (isset($playlist_index)) {
$url = addQueryStringParameter($url, 'playlist_index', $playlist_index);
}
return $url;
@ -428,7 +428,7 @@ class PlayLists extends PluginAbstract {
$img = $images["path"];
im_resizeV2($img, $tvg_logo_path, 150, 150, 80);
}
$tvg_logo_url = Video::getURLToFile($tvg_logo);
return $tvg_logo_url;
} else {
@ -760,4 +760,45 @@ class PlayLists extends PluginAbstract {
//return '<a href="plugin/PlayLists/View/editor.php" class="btn btn-primary btn-sm btn-xs btn-block"><i class="fa fa-edit"></i> Schedule</a>';
}
public static function setAutoAddPlaylist($users_id, $playlists_id) {
$playlists_id = intval($playlists_id);
$user = new User($users_id);
$paramName = 'autoadd_playlist';
return $user->addExternalOptions($paramName, $playlists_id);
}
public static function getAutoAddPlaylist($users_id) {
$user = new User($users_id);
$paramName = 'autoadd_playlist';
return $user->getExternalOption($paramName);
}
public static function getPLButtons($playlists_id, $showMore = true) {
global $global;
include $global['systemRootPath'] . 'plugin/PlayLists/View/getPlaylistButtons.php';
}
public function getMyAccount($users_id) {
global $global;
include $global['systemRootPath'] . 'plugin/PlayLists/getMyAccount.php';
}
public function onNewVideo($videos_id) {
if (empty($videos_id)) {
return false;
}
$video = new Video('', '', $videos_id);
$users_id = $video->getUsers_id();
$playlists_id = PlayLists::getAutoAddPlaylist($users_id);
if (!empty($playlists_id)) {
return self::addVideo($videos_id, $playlists_id);
}
return false;
}
static public function addVideo($videos_id, $playlists_id, $add = true, $order = 0) {
$pl = new PlayList($playlists_id);
return $pl->addVideo($videos_id, $add, $order);
}
}

View file

@ -0,0 +1,150 @@
<?php
if (empty($playlists_id)) {
echo 'empty playlist id';
return '';
}
$program = PlayList::getFromDbFromId($playlists_id);
//var_dump($playlists_id, $program);
$isMyChannel = $program['users_id'] == User::getId();
$playListButtons = AVideoPlugin::getPlayListButtons($playlists_id);
$link = PlayLists::getLink($program['id']);
$isASerie = PlayLists::isPlayListASerie($program['id']);
if (empty($isASerie)) {
$currentSerieVideos_id = 0;
} else {
$currentSerieVideos_id = $isASerie['id'];
}
?>
<a href="<?php echo $link; ?>" class="btn btn-xs btn-default playAll hrefLink" data-toggle="tooltip" title="<?php echo __("Play All"); ?>" >
<span class="fa fa-play"></span> <span class="hidden-sm hidden-xs"><?php echo __("Play All"); ?></span>
</a>
<?php echo $playListButtons; ?>
<?php
echo PlayLists::getPlayLiveButton($program['id']);
if ($isMyChannel) {
?>
<script>
$(function () {
$("#sortable<?php echo $program['id']; ?>").sortable({
items: "li",
stop: function (event, ui) {
modal.showPleaseWait();
saveSortable(this, <?php echo $program['id']; ?>);
}
});
$("#sortable<?php echo $program['id']; ?>").disableSelection();
});
</script>
<div class="dropdown" style="display: inline-block;">
<button class="btn btn-default btn-xs dropdown-toggle" type="button" data-toggle="dropdown">
<i class="fas fa-sort-amount-down"></i>
<?php echo __("Auto Sort"); ?>
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="<?php echo $global['webSiteRootURL']; ?>objects/playlistSort.php?playlist_id=<?php echo $program['id']; ?>&sort=1"><i class="fas fa-sort-alpha-down"></i> <?php echo __("Alphabetical"); ?> A-Z</a></li>
<li><a href="<?php echo $global['webSiteRootURL']; ?>objects/playlistSort.php?playlist_id=<?php echo $program['id']; ?>&sort=2"><i class="fas fa-sort-alpha-down-alt"></i> <?php echo __("Alphabetical"); ?> Desc Z-A</a></li>
<li><a href="<?php echo $global['webSiteRootURL']; ?>objects/playlistSort.php?playlist_id=<?php echo $program['id']; ?>&sort=3"><i class="fas fa-sort-numeric-down"></i> <?php echo __("Created Date"); ?> 0-9</a></li>
<li><a href="<?php echo $global['webSiteRootURL']; ?>objects/playlistSort.php?playlist_id=<?php echo $program['id']; ?>&sort=4"><i class="fas fa-sort-numeric-down-alt"></i> <?php echo __("Created Date"); ?> Desc 9-0</a></li>
</ul>
</div>
<div class="dropdown" style="display: inline-block;">
<button class="btn btn-default btn-xs dropdown-toggle" type="button" data-toggle="dropdown">
<i class="fas fa-rss-square"></i>
<span class="hidden-xs hidden-sm"><?php echo __("Feed"); ?></span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="<?php echo $global['webSiteRootURL']; ?>feed/?program_id=<?php echo $program['id']; ?>" target="_blank">RSS</a></li>
<li><a href="<?php echo $global['webSiteRootURL']; ?>mrss/?program_id=<?php echo $program['id']; ?>" target="_blank">MRSS</a></li>
<li><a href="<?php echo $global['webSiteRootURL']; ?>roku.json?program_id=<?php echo $program['id']; ?>" target="_blank">Roku</a></li>
</ul>
</div>
<div class="pull-right btn-group" style="display: inline-flex;">
<?php
echo PlayLists::getShowOnTVSwitch($program['id']);
if ($program['status'] != "favorite" && $program['status'] != "watch_later") {
if (AVideoPlugin::isEnabledByName("PlayLists")) {
?>
<button class="btn btn-xs btn-default" onclick="copyToClipboard($('#playListEmbedCode<?php echo $program['id']; ?>').val()); setTextEmbedCopied();" data-toggle="tooltip" title="<?php echo __("Copy Embed code"); ?>" >
<span class="fa fa-copy"></span> <span id="btnEmbedText" class="hidden-sm hidden-xs"><?php echo __("Embed code"); ?></span>
</button>
<input type="hidden" id="playListEmbedCode<?php echo $program['id']; ?>" value='<?php
$code = str_replace("{embedURL}", "{$global['webSiteRootURL']}plugin/PlayLists/embed.php?playlists_id={$program['id']}", $advancedCustom->embedCodeTemplate);
echo($code);
?>'/>
<button class="btn btn-xs btn-default" onclick="copyToClipboard($('#playListEmbedGallery<?php echo $program['id']; ?>').val()); setTextGalleryCopied();" data-toggle="tooltip" title="<?php echo __("Copy Embed code"); ?>">
<span class="fa fa-copy"></span> <span id="btnEmbedGalleryText" class="hidden-sm hidden-xs"><?php echo __("Embed Gallery"); ?></span>
</button>
<input type="hidden" id="playListEmbedGallery<?php echo $program['id']; ?>" value='<?php
$code = str_replace("{embedURL}", "{$global['webSiteRootURL']}plugin/PlayLists/playerEmbed.php?playlists_id={$program['id']}", $advancedCustom->embedCodeTemplate);
echo($code);
?>'/>
<?php
}
if (User::canUpload()) {
?>
<button class="btn btn-xs btn-info seriePlaylist" playlist_id="<?php echo $program['id']; ?>" data-toggle="tooltip" title="<?php echo __('Add this playlist in your video library'); ?>" >
<i class="fas fa-film"></i> <span class="hidden-xs hidden-sm"><?php echo __("Serie"); ?></span>
</button>
<div id="seriePlaylistModal" class="modal fade" tabindex="-1" role="dialog" >
<div class="modal-dialog" role="document" style="width: 90%; margin: auto;">
<div class="modal-content">
<div class="modal-body">
<iframe style="width: 100%; height: 80vh;" src="about:blank">
</iframe>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script>
$(function () {
$('.seriePlaylist').click(function () {
$($('#seriePlaylistModal').find('iframe')[0]).attr('src', 'about:blank');
var playlist_id = $(this).attr('playlist_id');
$($('#seriePlaylistModal').find('iframe')[0]).attr('src', '<?php echo $global['webSiteRootURL']; ?>plugin/PlayLists/playListToSerie.php?playlist_id=' + playlist_id);
$('#seriePlaylistModal').modal();
//$('#seriePlaylistModal').modal('hide');
});
});
</script>
<?php }
?>
<button class="btn btn-xs btn-danger deletePlaylist" playlist_id="<?php echo $program['id']; ?>" data-toggle="tooltip" title="<?php echo __('Delete'); ?>" ><i class="fas fa-trash"></i> <span class="hidden-xs hidden-sm"><?php echo __("Delete"); ?></span></button>
<button class="btn btn-xs btn-primary renamePlaylist" playlist_id="<?php echo $program['id']; ?>" data-toggle="tooltip" title="<?php echo __('Rename'); ?>" ><i class="fas fa-edit"></i> <span class="hidden-xs hidden-sm"><?php echo __("Rename"); ?></span></button>
<button class="btn btn-xs btn-success" onclick="openVideoSearch(<?php echo $currentSerieVideos_id; ?>)" playlist_id="<?php echo $program['id']; ?>" data-toggle="tooltip" title="<?php echo __('Add to Program'); ?>" ><i class="fas fa-plus"></i> <span class="hidden-xs hidden-sm"><?php echo __("Add"); ?></span></button>
<button class="btn btn-xs btn-default statusPlaylist statusPlaylist<?php echo $program['id']; ?>" playlist_id="<?php echo $program['id']; ?>" style="" >
<span class="fa fa-lock" id="statusPrivate<?php echo $program['id']; ?>" style="color: red; <?php
if ($program['status'] !== 'private') {
echo ' display: none;';
}
?> " data-toggle="tooltip" title="<?php echo __('This playlist is private, click to make it public'); ?>" ></span>
<span class="fa fa-globe" id="statusPublic<?php echo $program['id']; ?>" style="color: green; <?php
if ($program['status'] !== 'public') {
echo ' display: none;';
}
?>" data-toggle="tooltip" title="<?php echo __('This playlist is public, click to make it unlisted'); ?>" ></span>
<span class="fa fa-eye-slash" id="statusUnlisted<?php echo $program['id']; ?>" style="color: gray; <?php
if ($program['status'] !== 'unlisted') {
echo ' display: none;';
}
?>" data-toggle="tooltip" title="<?php echo __('This playlist is unlisted, click to make it private'); ?>" ></span>
</button>
<?php
}
if ($showMore) {
?>
<a class="btn btn-xs btn-default" href="<?php echo $global['webSiteRootURL']; ?>viewProgram/<?php echo $program['id']; ?>/<?php echo urlencode(cleanURLName($program['name'])); ?>/" data-toggle="tooltip" title="<?php echo __("More"); ?>">
<?php echo __('More'); ?> <i class="fas fa-ellipsis-h"></i>
</a>
<?php
}
?>
</div>
<?php }
?>

View file

@ -0,0 +1,52 @@
<?php
$autoadd_playlist = PlayLists::getAutoAddPlaylist($users_id);
//var_dump($autoadd_playlist, $users_id);exit;
?>
<div class="form-group">
<label class="col-md-4 control-label">
<?php echo __("Auto add new videos on PlayList"); ?>
</label>
<div class="col-md-8 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon">
<i class="fas fa-list"></i>
</span>
<select class="form-control" id="autoadd_playlist">
<option value="0"><?php echo __('Do not add'); ?></option>
<?php
$pls = PlayList::getAllFromUserLight(User::getId(), false);
foreach ($pls as $value) {
$selected = '';
if($autoadd_playlist === $value['id']){
$selected = 'selected';
}
echo "<option value=\"{$value['id']}\" {$selected}>{$value['name']}</option>";
}
?>
</select>
</div>
</div>
</div>
<script>
$(document).ready(function () {
$('#autoadd_playlist').change(function (e) {
saveAutoadd_playlist();
});
});
function saveAutoadd_playlist() {
var autoadd_playlist = $('#autoadd_playlist').val();
modal.showPleaseWait();
$.ajax({
url: webSiteRootURL + 'plugin/PlayLists/getMyAccount.save.json.php',
data: {autoadd_playlist: autoadd_playlist},
type: 'post',
success: function (response) {
avideoResponse(response);
modal.hidePleaseWait();
}
});
}
</script>

View file

@ -0,0 +1,29 @@
<?php
require_once '../../videos/configuration.php';
session_write_close();
header('Content-Type: application/json');
$obj = new stdClass();
$obj->error = true;
$obj->msg = "";
if(!User::isLogged()){
$obj->msg = "Not logged";
die(json_encode($obj));
}
if(!isset($_POST['autoadd_playlist'])){
$obj->msg = "autoadd_playlist is empty";
die(json_encode($obj));
}
$obj->autoadd_playlist = @$_POST['autoadd_playlist'];
$pp = AVideoPlugin::loadPluginIfEnabled('PlayLists');
if(empty($pp)){
$obj->msg = "Plugin not enabled";
die(json_encode($obj));
}
$response = PlayLists::setAutoAddPlaylist(User::getId(), $_POST['autoadd_playlist']);
$obj->error = empty($response);
die(json_encode($obj));

View file

@ -55,7 +55,6 @@ unset($_POST['current']);
if ($current == 1) {
echo "<div class='alert alert-warning'><i class=\"fas fa-exclamation-triangle\"></i> " . __('Sorry you do not have anything available') . "</div>";
}
die("</div>");
}
$playListsObj = AVideoPlugin::getObjectData("PlayLists");
@ -108,7 +107,6 @@ unset($_POST['current']);
$startC = microtime(true);
//_error_log("channelPlaylist videosP2: ".json_encode($videosP));
//_error_log("channelPlaylist videosArrayId: ".json_encode($videosArrayId));
$playListButtons = AVideoPlugin::getPlayListButtons($playlist['id']);
@$timesC[__LINE__] += microtime(true) - $startC;
$startC = microtime(true);
$countSuccess++;
@ -120,90 +118,9 @@ unset($_POST['current']);
<strong style="font-size: 1.1em;" class="playlistName">
<?php echo __($playlist['name']); ?> (<?php echo secondsToDuration($totalDuration); ?>)
</strong>
<?php
if (!empty($videosArrayId)) {
$link = PlayLists::getLink($playlist['id']);
?>
<a href="<?php echo $link; ?>" class="btn btn-xs btn-default playAll hrefLink" ><span class="fa fa-play"></span> <?php echo __("Play All"); ?></a><?php echo $playListButtons; ?>
<?php
}
echo PlayLists::getPlayLiveButton($playlist['id']);
PlayLists::getPLButtons($playlist['id']);
?>
<div class="pull-right btn-group" style="display: inline-flex;">
<?php
if ($isMyChannel) {
echo PlayLists::getShowOnTVSwitch($playlist['id']);
if ($playlist['status'] != "favorite" && $playlist['status'] != "watch_later") {
if (AVideoPlugin::isEnabledByName("PlayLists")) {
?>
<button class="btn btn-xs btn-default" onclick="copyToClipboard($('#playListEmbedCode<?php echo $playlist['id']; ?>').val()); setTextEmbedCopied();" ><span class="fa fa-copy"></span> <span id="btnEmbedText"><?php echo __("Copy embed code"); ?></span></button>
<input type="hidden" id="playListEmbedCode<?php echo $playlist['id']; ?>" value='<?php
$code = str_replace("{embedURL}", "{$global['webSiteRootURL']}plugin/PlayLists/embed.php?playlists_id={$playlist['id']}", $advancedCustom->embedCodeTemplate);
echo($code);
?>'/>
<button class="btn btn-xs btn-default" onclick="copyToClipboard($('#playListEmbedGallery<?php echo $playlist['id']; ?>').val()); setTextGalleryCopied();" ><span class="fa fa-copy"></span> <span id="btnEmbedGalleryText"><?php echo __("Copy embed Gallery"); ?></span></button>
<input type="hidden" id="playListEmbedGallery<?php echo $playlist['id']; ?>" value='<?php
$code = str_replace("{embedURL}", "{$global['webSiteRootURL']}plugin/PlayLists/playerEmbed.php?playlists_id={$playlist['id']}", $advancedCustom->embedCodeTemplate);
echo($code);
?>'/>
<?php
}
if (User::canUpload()) {
?>
<button class="btn btn-xs btn-info seriePlaylist" playlist_id="<?php echo $playlist['id']; ?>" ><i class="fas fa-film"></i> <?php echo __("Serie"); ?></button>
<div id="seriePlaylistModal" class="modal fade" tabindex="-1" role="dialog" >
<div class="modal-dialog" role="document" style="width: 90%; margin: auto;">
<div class="modal-content">
<div class="modal-body">
<iframe style="width: 100%; height: 80vh;" src="about:blank">
</iframe>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script>
$(function () {
$('.seriePlaylist').click(function () {
$($('#seriePlaylistModal').find('iframe')[0]).attr('src', 'about:blank');
var playlist_id = $(this).attr('playlist_id');
$($('#seriePlaylistModal').find('iframe')[0]).attr('src', '<?php echo $global['webSiteRootURL']; ?>plugin/PlayLists/playListToSerie.php?playlist_id=' + playlist_id);
$('#seriePlaylistModal').modal();
//$('#seriePlaylistModal').modal('hide');
});
});
</script>
<?php }
?>
<button class="btn btn-xs btn-danger deletePlaylist" playlist_id="<?php echo $playlist['id']; ?>" ><i class="fas fa-trash"></i> <?php echo __("Delete"); ?></button>
<button class="btn btn-xs btn-primary renamePlaylist" playlist_id="<?php echo $playlist['id']; ?>" ><i class="fas fa-edit"></i> <?php echo __("Rename"); ?></button>
<button class="btn btn-xs btn-default statusPlaylist statusPlaylist<?php echo $playlist['id']; ?>" playlist_id="<?php echo $playlist['id']; ?>" style="" >
<span class="fa fa-lock" id="statusPrivate<?php echo $playlist['id']; ?>" style="color: red; <?php
if ($playlist['status'] !== 'private') {
echo ' display: none;';
}
?> " ></span>
<span class="fa fa-globe" id="statusPublic<?php echo $playlist['id']; ?>" style="color: green; <?php
if ($playlist['status'] !== 'public') {
echo ' display: none;';
}
?>"></span>
<span class="fa fa-eye-slash" id="statusUnlisted<?php echo $playlist['id']; ?>" style="color: gray; <?php
if ($playlist['status'] !== 'unlisted') {
echo ' display: none;';
}
?>"></span>
</button>
<?php
}
}
?>
<a class="btn btn-xs btn-default" href="<?php echo $global['webSiteRootURL']; ?>viewProgram/<?php echo $playlist['id']; ?>/<?php echo urlencode(cleanURLName($playlist['name'])); ?>/">
<?php echo __('More'); ?> <i class="fas fa-ellipsis-h"></i>
</a>
</div>
</div>
<?php

View file

@ -91,122 +91,16 @@ $playListsObj = AVideoPlugin::getObjectData("PlayLists");
$startC = microtime(true);
//_error_log("channelPlaylist videosP2: ".json_encode($videosP));
//_error_log("channelPlaylist videosArrayId: ".json_encode($videosArrayId));
$playListButtons = AVideoPlugin::getPlayListButtons($program['id']);
@$timesC[__LINE__] += microtime(true) - $startC;
$startC = microtime(true);
$isASerie = PlayLists::isPlayListASerie($program['id']);
if (empty($isASerie)) {
$currentSerieVideos_id = 0;
} else {
$currentSerieVideos_id = $isASerie['id'];
}
?>
<br>
<div class="panel panel-default program" playListId="<?php echo $program['id']; ?>">
<div class="panel-heading">
<strong class="playlistName"><?php echo $program['name']; ?> </strong>
<?php
if (!empty($videosArrayId)) {
$link = PlayLists::getLink($program['id']);
?>
<a href="<?php echo $link; ?>" class="btn btn-xs btn-default playAll hrefLink" ><span class="fa fa-play"></span> <?php echo __("Play All"); ?></a><?php echo $playListButtons; ?>
<?php
echo PlayLists::getPlayLiveButton($program['id']);
}
if ($isMyChannel) {
?>
<script>
$(function () {
$("#sortable<?php echo $program['id']; ?>").sortable({
items: "li",
stop: function (event, ui) {
modal.showPleaseWait();
saveSortable(this, <?php echo $program['id']; ?>);
}
});
$("#sortable<?php echo $program['id']; ?>").disableSelection();
});
</script>
<div class="dropdown" style="display: inline-block;">
<button class="btn btn-default btn-xs dropdown-toggle" type="button" data-toggle="dropdown"><?php echo __("Auto Sort"); ?>
<span class="caret"></span></button>
<ul class="dropdown-menu">
<li><a href="<?php echo $global['webSiteRootURL']; ?>objects/playlistSort.php?playlist_id=<?php echo $program['id']; ?>&sort=1"><?php echo __("Alphabetical"); ?> A-Z</a></li>
<li><a href="<?php echo $global['webSiteRootURL']; ?>objects/playlistSort.php?playlist_id=<?php echo $program['id']; ?>&sort=2"><?php echo __("Alphabetical"); ?> Desc Z-A</a></li>
<li><a href="<?php echo $global['webSiteRootURL']; ?>objects/playlistSort.php?playlist_id=<?php echo $program['id']; ?>&sort=3"><?php echo __("Created Date"); ?> 0-9</a></li>
<li><a href="<?php echo $global['webSiteRootURL']; ?>objects/playlistSort.php?playlist_id=<?php echo $program['id']; ?>&sort=4"><?php echo __("Created Date"); ?> Desc 9-0</a></li>
</ul>
</div>
<div class="pull-right btn-group" style="display: inline-flex;">
<?php echo PlayLists::getShowOnTVSwitch($program['id']); ?>
<?php
if ($program['status'] != "favorite" && $program['status'] != "watch_later") {
if (AVideoPlugin::isEnabledByName("PlayLists")) {
?>
<button class="btn btn-xs btn-default" onclick="copyToClipboard($('#playListEmbedCode<?php echo $program['id']; ?>').val());setTextEmbedCopied();" data-toggle="tooltip" title="<?php echo __('Copy embed code'); ?>" >
<span class="fa fa-copy"></span>
<span id="btnEmbedText" class="hidden-xs hidden-sm"><?php echo __("Copy embed code"); ?></span></button>
<input type="hidden" id="playListEmbedCode<?php echo $program['id']; ?>" value='<iframe width="640" height="480" style="max-width: 100%;max-height: 100%;" src="<?php echo $global['webSiteRootURL']; ?>plugin/PlayLists/embed.php?playlists_id=<?php echo $program['id']; ?>" frameborder="0" <?php echo Video::$iframeAllowAttributes; ?>></iframe>'/>
<?php
}
if (User::canUpload()) {
?>
<button class="btn btn-xs btn-info seriePlaylist" playlist_id="<?php echo $program['id']; ?>" data-toggle="tooltip" title="<?php echo __('Add this playlist in your video library'); ?>" >
<i class="fas fa-film"></i> <span class="hidden-xs hidden-sm"><?php echo __("Serie"); ?></span>
</button>
<div id="seriePlaylistModal" class="modal fade" tabindex="-1" role="dialog" >
<div class="modal-dialog" role="document" style="width: 90%; margin: auto;">
<div class="modal-content">
<div class="modal-body">
<iframe style="width: 100%; height: 80vh;" src="about:blank">
</iframe>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script>
$(function () {
$('.seriePlaylist').click(function () {
$($('#seriePlaylistModal').find('iframe')[0]).attr('src', 'about:blank');
var playlist_id = $(this).attr('playlist_id');
$($('#seriePlaylistModal').find('iframe')[0]).attr('src', '<?php echo $global['webSiteRootURL']; ?>plugin/PlayLists/playListToSerie.php?playlist_id=' + playlist_id);
$('#seriePlaylistModal').modal();
//$('#seriePlaylistModal').modal('hide');
});
});
</script>
<?php }
?>
<button class="btn btn-xs btn-danger deletePlaylist" playlist_id="<?php echo $program['id']; ?>" data-toggle="tooltip" title="<?php echo __('Delete'); ?>" ><i class="fas fa-trash"></i> <span class="hidden-xs hidden-sm"><?php echo __("Delete"); ?></span></button>
<button class="btn btn-xs btn-primary renamePlaylist" playlist_id="<?php echo $program['id']; ?>" data-toggle="tooltip" title="<?php echo __('Rename'); ?>" ><i class="fas fa-edit"></i> <span class="hidden-xs hidden-sm"><?php echo __("Rename"); ?></span></button>
<button class="btn btn-xs btn-success" onclick="openVideoSearch(<?php echo $currentSerieVideos_id; ?>)" playlist_id="<?php echo $program['id']; ?>" data-toggle="tooltip" title="<?php echo __('Add to Program'); ?>" ><i class="fas fa-plus"></i> <span class="hidden-xs hidden-sm"><?php echo __("Add"); ?></span></button>
<button class="btn btn-xs btn-default statusPlaylist statusPlaylist<?php echo $program['id']; ?>" playlist_id="<?php echo $program['id']; ?>" style="" >
<span class="fa fa-lock" id="statusPrivate<?php echo $program['id']; ?>" style="color: red; <?php
if ($program['status'] !== 'private') {
echo ' display: none;';
}
?> " data-toggle="tooltip" title="<?php echo __('This playlist is private, click to make it public'); ?>" ></span>
<span class="fa fa-globe" id="statusPublic<?php echo $program['id']; ?>" style="color: green; <?php
if ($program['status'] !== 'public') {
echo ' display: none;';
}
?>" data-toggle="tooltip" title="<?php echo __('This playlist is public, click to make it unlisted'); ?>" ></span>
<span class="fa fa-eye-slash" id="statusUnlisted<?php echo $program['id']; ?>" style="color: gray; <?php
if ($program['status'] !== 'unlisted') {
echo ' display: none;';
}
?>" data-toggle="tooltip" title="<?php echo __('This playlist is unlisted, click to make it private'); ?>" ></span>
</button>
<?php }
?>
</div>
<?php }
PlayLists::getPLButtons($program['id'], false);
?>
</div>

View file

@ -24,11 +24,11 @@ foreach ($tags as $value) {
<?php
include $global['systemRootPath'] . 'view/include/head.php';
?>
<link href="<?php echo getCDN(); ?>node_modules/croppie/croppie.css" rel="stylesheet" type="text/css"/>
<script src="<?php echo getCDN(); ?>node_modules/croppie/croppie.min.js" type="text/javascript"></script>
<link href="<?php echo getCDN(); ?>view/js/bootstrap-fileinput/css/fileinput.min.css" rel="stylesheet" type="text/css"/>
<script src="<?php echo getCDN(); ?>view/js/bootstrap-fileinput/js/fileinput.min.js" type="text/javascript"></script>
<link href="<?php echo getCDN(); ?>view/css/bodyFadein.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo getURL('node_modules/croppie/croppie.css'); ?>" rel="stylesheet" type="text/css"/>
<script src="<?php echo getURL('node_modules/croppie/croppie.min.js'); ?>" type="text/javascript"></script>
<link href="<?php echo getURL('view/js/bootstrap-fileinput/css/fileinput.min.css'); ?>" rel="stylesheet" type="text/css"/>
<script src="<?php echo getURL('view/js/bootstrap-fileinput/js/fileinput.min.js'); ?>" type="text/javascript"></script>
<link href="<?php echo getURL('view/css/bodyFadein.css'); ?>" rel="stylesheet" type="text/css"/>
</head>
<body class="<?php echo $global['bodyClass']; ?>">
@ -94,14 +94,14 @@ foreach ($tags as $value) {
?>
<script>
$(document).ready(function () {
<?php
if (!empty($_REQUEST['tab'])) {
$tab = preg_replace('/[^a-z0-9_-]/i', '', $_REQUEST['tab']);
?>
$('#userTabsPanel a[href="#<?php echo $tab; ?>"]').trigger('click');
<?php
}
?>
<?php
if (!empty($_REQUEST['tab'])) {
$tab = preg_replace('/[^a-z0-9_-]/i', '', $_REQUEST['tab']);
?>
$('#userTabsPanel a[href="#<?php echo $tab; ?>"]').trigger('click');
<?php
}
?>
});
</script>
</body>