mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-06 03:50:04 +02:00
This commit is contained in:
parent
b3e8ca9eb0
commit
4ddac1f8ce
11 changed files with 309 additions and 151 deletions
|
@ -332,12 +332,15 @@ class Category {
|
|||
return $id;
|
||||
}
|
||||
|
||||
static function getAllCategories($filterCanAddVideoOnly = false) {
|
||||
static function getAllCategories($filterCanAddVideoOnly = false, $onlyWithVideos = false) {
|
||||
global $global, $config;
|
||||
if ($config->currentVersionLowerThen('8.4')) {
|
||||
return false;
|
||||
}
|
||||
$sql = "SELECT * FROM categories WHERE 1=1 ";
|
||||
$sql = "SELECT * FROM categories c WHERE 1=1 ";
|
||||
if (!empty($_GET['parentsOnly'])) {
|
||||
$sql .= "AND parentId = 0 ";
|
||||
}
|
||||
if ($filterCanAddVideoOnly && !User::isAdmin()) {
|
||||
if (is_int($filterCanAddVideoOnly)) {
|
||||
$users_id = $filterCanAddVideoOnly;
|
||||
|
@ -349,8 +352,8 @@ class Category {
|
|||
$sql .= " AND (private=0 OR users_id = '{$users_id}') ";
|
||||
}
|
||||
}
|
||||
if (!empty($_GET['parentsOnly'])) {
|
||||
$sql .= "AND parentId = 0 ";
|
||||
if ($onlyWithVideos) {
|
||||
$sql .= " AND (SELECT count(*) FROM videos where categories_id = c.id OR categories_id IN (SELECT id from categories where parentId = c.id)) > 0 ";
|
||||
}
|
||||
if (isset($_POST['sort']['title'])) {
|
||||
unset($_POST['sort']['title']);
|
||||
|
|
|
@ -8,6 +8,10 @@ if (!isset($global['systemRootPath'])) {
|
|||
require_once '../videos/configuration.php';
|
||||
}
|
||||
require_once $global['systemRootPath'] . 'objects/functions.php';
|
||||
|
||||
$timeLog = __FILE__."::Login ";
|
||||
TimeLogStart($timeLog);
|
||||
|
||||
// gettig the mobile submited value
|
||||
$inputJSON = url_get_contents('php://input');
|
||||
$input = json_decode($inputJSON, TRUE); //convert JSON into array
|
||||
|
@ -17,6 +21,7 @@ if (!empty($input)) {
|
|||
}
|
||||
}
|
||||
|
||||
TimeLogEnd($timeLog, __LINE__);
|
||||
|
||||
require_once $global['systemRootPath'] . 'videos/configuration.php';
|
||||
require_once $global['systemRootPath'] . 'objects/hybridauth/autoload.php';
|
||||
|
@ -24,7 +29,7 @@ require_once $global['systemRootPath'] . 'objects/user.php';
|
|||
require_once $global['systemRootPath'] . 'objects/category.php';
|
||||
|
||||
Category::clearCacheCount();
|
||||
|
||||
TimeLogEnd($timeLog, __LINE__);
|
||||
_error_log("Start Login Request");
|
||||
|
||||
_error_log("redirectUri: " . $_POST['redirectUri']);
|
||||
|
@ -36,7 +41,7 @@ _error_log("same redirectUri: " . $_POST['redirectUri']);
|
|||
|
||||
use Hybridauth\Hybridauth;
|
||||
use Hybridauth\HttpClient;
|
||||
|
||||
TimeLogEnd($timeLog, __LINE__);
|
||||
if (!empty($_GET['type'])) {
|
||||
if (!empty($_GET['redirectUri'])) {
|
||||
if (session_status() == PHP_SESSION_NONE) {
|
||||
|
@ -126,7 +131,7 @@ if (!empty($_GET['type'])) {
|
|||
}
|
||||
return;
|
||||
}
|
||||
|
||||
TimeLogEnd($timeLog, __LINE__);
|
||||
$object = new stdClass();
|
||||
if (!empty($_GET['user'])) {
|
||||
$_POST['user'] = $_GET['user'];
|
||||
|
@ -146,7 +151,7 @@ if (empty($_POST['user']) || empty($_POST['pass'])) {
|
|||
}
|
||||
$user = new User(0, $_POST['user'], $_POST['pass']);
|
||||
$resp = $user->login(false, @$_POST['encodedPass']);
|
||||
|
||||
TimeLogEnd($timeLog, __LINE__);
|
||||
$object->isCaptchaNeed = User::isCaptchaNeed();
|
||||
if ($resp === User::USER_NOT_VERIFIED) {
|
||||
$object->error = __("Your user is not verified, we sent you a new e-mail");
|
||||
|
@ -184,12 +189,14 @@ if (empty($advancedCustomUser->userCanNotChangeCategory) || User::isAdmin()) {
|
|||
} else {
|
||||
$object->categories = array();
|
||||
}
|
||||
|
||||
TimeLogEnd($timeLog, __LINE__);
|
||||
$object->userGroups = UserGroups::getAllUsersGroups();
|
||||
|
||||
TimeLogEnd($timeLog, __LINE__);
|
||||
$object->streamServerURL = "";
|
||||
$object->streamKey = "";
|
||||
if ($object->isLogged) {
|
||||
$timeLog2 = __FILE__."::Is Logged ";
|
||||
TimeLogStart($timeLog2);
|
||||
$p = AVideoPlugin::loadPluginIfEnabled("Live");
|
||||
if (!empty($p)) {
|
||||
require_once $global['systemRootPath'] . 'plugin/Live/Objects/LiveTransmition.php';
|
||||
|
@ -197,29 +204,31 @@ if ($object->isLogged) {
|
|||
$object->streamServerURL = $p->getServer() . "?p=" . User::getUserPass();
|
||||
$object->streamKey = $trasnmition['key'];
|
||||
}
|
||||
TimeLogEnd($timeLog2, __LINE__);
|
||||
$p = AVideoPlugin::loadPluginIfEnabled("MobileManager");
|
||||
if (!empty($p)) {
|
||||
$object->streamer = json_decode(url_get_contents($global['webSiteRootURL'] . "objects/status.json.php"));
|
||||
$object->plugin = $p->getDataObject();
|
||||
$object->encoder = $config->getEncoderURL();
|
||||
}
|
||||
|
||||
TimeLogEnd($timeLog2, __LINE__);
|
||||
$p = AVideoPlugin::loadPluginIfEnabled("VideoHLS");
|
||||
if (!empty($p)) {
|
||||
$object->videoHLS = true;
|
||||
}
|
||||
|
||||
TimeLogEnd($timeLog2, __LINE__);
|
||||
$p = AVideoPlugin::loadPluginIfEnabled("Subscription");
|
||||
if (!empty($p)) {
|
||||
$object->Subscription = Subscription::getAllFromUser($object->id);
|
||||
}
|
||||
|
||||
TimeLogEnd($timeLog2, __LINE__);
|
||||
$p = AVideoPlugin::loadPluginIfEnabled("PayPerView");
|
||||
if (!empty($p) && class_exists('PayPerView')) {
|
||||
$object->PayPerView = PayPerView::getAllPPVFromUser($object->id);
|
||||
}
|
||||
TimeLogEnd($timeLog2, __LINE__);
|
||||
}
|
||||
|
||||
TimeLogEnd($timeLog, __LINE__);
|
||||
$json = json_encode($object, JSON_UNESCAPED_UNICODE);
|
||||
header("Content-length: " . strlen($json));
|
||||
echo $json;
|
||||
|
|
|
@ -820,7 +820,9 @@ if (!class_exists('Video')) {
|
|||
if ($config->currentVersionLowerThen('5')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!empty($_POST['sort']['suggested'])){
|
||||
$suggestedOnly = true;
|
||||
}
|
||||
if (AVideoPlugin::isEnabledByName("VideoTags")) {
|
||||
if (!empty($_GET['tags_id']) && empty($videosArrayId)) {
|
||||
$videosArrayId = VideoTags::getAllVideosIdFromTagsId($_GET['tags_id']);
|
||||
|
@ -1079,11 +1081,14 @@ if (!class_exists('Video')) {
|
|||
return $videos;
|
||||
}
|
||||
|
||||
static function getTotalVideos($status = "viewable", $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $showUnlisted = false, $activeUsersOnly = true) {
|
||||
static function getTotalVideos($status = "viewable", $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $showUnlisted = false, $activeUsersOnly = true, $suggestedOnly = false) {
|
||||
global $global, $config;
|
||||
if ($config->currentVersionLowerThen('5')) {
|
||||
return false;
|
||||
}
|
||||
if(!empty($_POST['sort']['suggested'])){
|
||||
$suggestedOnly = true;
|
||||
}
|
||||
$status = str_replace("'", "", $status);
|
||||
$cn = "";
|
||||
if (!empty($_GET['catName'])) {
|
||||
|
@ -1144,6 +1149,9 @@ if (!class_exists('Video')) {
|
|||
|
||||
$sql .= BootGrid::getSqlSearchFromPost(array('v.title', 'v.description', 'c.name'));
|
||||
|
||||
if ($suggestedOnly) {
|
||||
$sql .= " AND v.isSuggested = 1 ";
|
||||
}
|
||||
$res = sqlDAL::readSql($sql);
|
||||
$numRows = sqlDal::num_rows($res);
|
||||
sqlDAL::close($res);
|
||||
|
@ -1697,14 +1705,18 @@ if (!class_exists('Video')) {
|
|||
|
||||
static function getTags_($video_id, $type = "") {
|
||||
global $advancedCustom, $advancedCustomUser;
|
||||
if(empty($advancedCustom)){
|
||||
$advancedCustomUser = AVideoPlugin::getObjectData("CustomizeUser");
|
||||
}
|
||||
if(empty($advancedCustom)){
|
||||
$advancedCustom = AVideoPlugin::getObjectData("CustomizeAdvanced");
|
||||
}
|
||||
$video = new Video("", "", $video_id);
|
||||
$tags = array();
|
||||
|
||||
if (empty($type) || $type === "paid") {
|
||||
$objTag = new stdClass();
|
||||
$objTag->label = __("Paid Content");
|
||||
if (!empty($advancedCustom->paidOnlyShowLabels)) {
|
||||
$ppv = AVideoPlugin::getObjectDataIfEnabled("PayPerView");
|
||||
if (!empty($video->getOnly_for_paid())) {
|
||||
$objTag->type = "warning";
|
||||
$objTag->text = $advancedCustom->paidOnlyLabel;
|
||||
|
|
|
@ -45,6 +45,10 @@ class Gallery extends PluginAbstract {
|
|||
$obj->Description = false;
|
||||
$obj->CategoryDescription = false;
|
||||
|
||||
$obj->Suggested = true;
|
||||
$obj->SuggestedCustomTitle = "";
|
||||
$obj->SuggestedRowCount = 12;
|
||||
|
||||
$obj->Trending = true;
|
||||
$obj->TrendingCustomTitle = "";
|
||||
$obj->TrendingRowCount = 12;
|
||||
|
|
|
@ -10,7 +10,7 @@ function showThis($who) {
|
|||
return false;
|
||||
}
|
||||
|
||||
function createGallery($title, $sort, $rowCount, $getName, $mostWord, $lessWord, $orderString, $defaultSort = "ASC", $ignoreGroup = false) {
|
||||
function createGallery($title, $sort, $rowCount, $getName, $mostWord, $lessWord, $orderString, $defaultSort = "ASC", $ignoreGroup = false, $icon = "fas fa-bookmark") {
|
||||
if (!showThis($getName)) {
|
||||
return "";
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ function createGallery($title, $sort, $rowCount, $getName, $mostWord, $lessWord,
|
|||
<div class="clear clearfix">
|
||||
<h3 class="galleryTitle">
|
||||
<a class="btn-default" href="<?php echo $global['webSiteRootURL']; ?>?showOnly=<?php echo $getName; ?>">
|
||||
<i class="glyphicon glyphicon-list-alt"></i>
|
||||
<i class="<?php echo $icon; ?>"></i>
|
||||
<?php
|
||||
if (empty($_GET[$getName])) {
|
||||
$_GET[$getName] = $defaultSort;
|
||||
|
|
|
@ -132,20 +132,23 @@ $contentSearchFound = false;
|
|||
?>
|
||||
<!-- For Live Videos End -->
|
||||
<?php
|
||||
if ($obj->Suggested) {
|
||||
createGallery(!empty($obj->SuggestedCustomTitle) ? $obj->SuggestedCustomTitle : __("Suggested"), 'suggested', $obj->SuggestedRowCount, 'SuggestedOrder', "", "", $orderString, "ASC", !$obj->hidePrivateVideos, "fas fa-star");
|
||||
}
|
||||
if ($obj->Trending) {
|
||||
createGallery(!empty($obj->TrendingCustomTitle) ? $obj->TrendingCustomTitle : __("Trending"), 'trending', $obj->TrendingRowCount, 'TrendingOrder', "zyx", "abc", $orderString, "ASC", !$obj->hidePrivateVideos);
|
||||
createGallery(!empty($obj->TrendingCustomTitle) ? $obj->TrendingCustomTitle : __("Trending"), 'trending', $obj->TrendingRowCount, 'TrendingOrder', "zyx", "abc", $orderString, "ASC", !$obj->hidePrivateVideos, "fas fa-chart-line");
|
||||
}
|
||||
if ($obj->SortByName) {
|
||||
createGallery(!empty($obj->SortByNameCustomTitle) ? $obj->SortByNameCustomTitle : __("Sort by name"), 'title', $obj->SortByNameRowCount, 'sortByNameOrder', "zyx", "abc", $orderString, "ASC", !$obj->hidePrivateVideos);
|
||||
createGallery(!empty($obj->SortByNameCustomTitle) ? $obj->SortByNameCustomTitle : __("Sort by name"), 'title', $obj->SortByNameRowCount, 'sortByNameOrder', "zyx", "abc", $orderString, "ASC", !$obj->hidePrivateVideos, "fas fa-font");
|
||||
}
|
||||
if ($obj->DateAdded) {
|
||||
createGallery(!empty($obj->DateAddedCustomTitle) ? $obj->DateAddedCustomTitle : __("Date added"), 'created', $obj->DateAddedRowCount, 'dateAddedOrder', __("newest"), __("oldest"), $orderString, "DESC", !$obj->hidePrivateVideos);
|
||||
createGallery(!empty($obj->DateAddedCustomTitle) ? $obj->DateAddedCustomTitle : __("Date added"), 'created', $obj->DateAddedRowCount, 'dateAddedOrder', __("newest"), __("oldest"), $orderString, "DESC", !$obj->hidePrivateVideos, "far fa-calendar-alt");
|
||||
}
|
||||
if ($obj->MostWatched) {
|
||||
createGallery(!empty($obj->MostWatchedCustomTitle) ? $obj->MostWatchedCustomTitle : __("Most watched"), 'views_count', $obj->MostWatchedRowCount, 'mostWatchedOrder', __("Most"), __("Fewest"), $orderString, "DESC", !$obj->hidePrivateVideos);
|
||||
createGallery(!empty($obj->MostWatchedCustomTitle) ? $obj->MostWatchedCustomTitle : __("Most watched"), 'views_count', $obj->MostWatchedRowCount, 'mostWatchedOrder', __("Most"), __("Fewest"), $orderString, "DESC", !$obj->hidePrivateVideos, "far fa-eye");
|
||||
}
|
||||
if ($obj->MostPopular) {
|
||||
createGallery(!empty($obj->MostPopularCustomTitle) ? $obj->MostPopularCustomTitle : __("Most popular"), 'likes', $obj->MostPopularRowCount, 'mostPopularOrder', __("Most"), __("Fewest"), $orderString, "DESC", !$obj->hidePrivateVideos);
|
||||
createGallery(!empty($obj->MostPopularCustomTitle) ? $obj->MostPopularCustomTitle : __("Most popular"), 'likes', $obj->MostPopularRowCount, 'mostPopularOrder', __("Most"), __("Fewest"), $orderString, "DESC", !$obj->hidePrivateVideos, "fas fa-fire");
|
||||
}
|
||||
if ($obj->SubscribedChannels && User::isLogged() && empty($_GET['showOnly'])) {
|
||||
$channels = Subscribe::getSubscribedChannels(User::getId());
|
||||
|
|
|
@ -13,7 +13,7 @@ if(empty($_GET['current'])){
|
|||
}else{
|
||||
$_POST['current'] = intval($_GET['current']);
|
||||
}
|
||||
$categories = Category::getAllCategories();
|
||||
$categories = Category::getAllCategories(false, true);
|
||||
$_POST['current'] = 1;
|
||||
$_POST['rowCount'] = $obj->CategoriesRowCount;
|
||||
?>
|
||||
|
|
|
@ -27,6 +27,8 @@ class YouPHPFlix2 extends PluginAbstract {
|
|||
$obj = new stdClass();
|
||||
$obj->hidePrivateVideos = false;
|
||||
$obj->pageDots = true;
|
||||
$obj->Suggested = true;
|
||||
$obj->SuggestedAutoPlay = true;
|
||||
$obj->PlayList = true;
|
||||
$obj->PlayListAutoPlay = true;
|
||||
$obj->Trending = true;
|
||||
|
|
|
@ -20,41 +20,7 @@ function isFlickityEnabled(selector) {
|
|||
}
|
||||
|
||||
$(function () {
|
||||
$(".thumbsImage").on("mouseenter", function () {
|
||||
//$(this).find(".thumbsGIF").height($(this).find(".thumbsJPG").height());
|
||||
//$(this).find(".thumbsGIF").width($(this).find(".thumbsJPG").width());
|
||||
$(this).find(".thumbsGIF").stop(true, true).fadeIn();
|
||||
});
|
||||
|
||||
$(".thumbsImage").on("mouseleave", function () {
|
||||
$(this).find(".thumbsGIF").stop(true, true).fadeOut();
|
||||
});
|
||||
|
||||
|
||||
$(".thumbsImage").on("click", function () {
|
||||
var crc = $(this).attr('crc');
|
||||
var myEleTop = $('.navbar-fixed-top .items-container').outerHeight(true);
|
||||
var row = $(this).closest('.row');
|
||||
$(this).addClass('active');
|
||||
$(this).parent().find(".arrow-down").fadeIn('slow');
|
||||
|
||||
$(".arrow-down").fadeOut();
|
||||
$(".thumbsImage").removeClass('active');
|
||||
|
||||
$('.poster').slideUp();
|
||||
if($('#poster'+crc).is(":hidden")){
|
||||
$('#poster'+crc).css('background-image', 'url(' + $('#poster'+crc).attr('poster') + ')');
|
||||
$('#poster'+crc).slideDown('slow', function () {
|
||||
var top = row.offset().top;
|
||||
$('html, body').animate({
|
||||
scrollTop: top - myEleTop
|
||||
}, 'slow');
|
||||
});
|
||||
}else{
|
||||
$carousel.flickity('playPlayer');
|
||||
}
|
||||
|
||||
});
|
||||
startModeFlix("");
|
||||
|
||||
setTimeout(function () {
|
||||
$('#loading').fadeOut();
|
||||
|
@ -64,8 +30,53 @@ $(function () {
|
|||
});
|
||||
}, 2000);
|
||||
|
||||
$carousel = $('.carousel').flickity();
|
||||
isFlickityEnabled('.carousel');
|
||||
});
|
||||
|
||||
function startModeFlix(container){
|
||||
|
||||
if($(container+".thumbsImage").attr('startModeFlix') == 1){
|
||||
return false;
|
||||
}
|
||||
|
||||
$(container+".thumbsImage").on("mouseenter", function () {
|
||||
//$(this).find(".thumbsGIF").height($(this).find(".thumbsJPG").height());
|
||||
//$(this).find(".thumbsGIF").width($(this).find(".thumbsJPG").width());
|
||||
$(this).find(".thumbsGIF").stop(true, true).fadeIn();
|
||||
});
|
||||
|
||||
$(container+".thumbsImage").on("mouseleave", function () {
|
||||
$(this).find(".thumbsGIF").stop(true, true).fadeOut();
|
||||
});
|
||||
|
||||
|
||||
$(container+".thumbsImage").on("click", function () {
|
||||
var crc = $(this).attr('crc');
|
||||
var myEleTop = $('.navbar-fixed-top .items-container').outerHeight(true);
|
||||
var row = $(this).closest('.row');
|
||||
$(this).addClass('active');
|
||||
$(this).parent().find(".arrow-down").fadeIn('slow');
|
||||
|
||||
$(".arrow-down").fadeOut();
|
||||
$(".thumbsImage").removeClass('active');
|
||||
$('.poster').not('#poster'+crc).slideUp();
|
||||
if($('#poster'+crc).is(":hidden")){
|
||||
$('#poster'+crc).css('background-image', 'url(' + $('#poster'+crc).attr('poster') + ')');
|
||||
$('#poster'+crc).slideDown('slow', function () {
|
||||
var top = row.offset().top;
|
||||
$('html, body').animate({
|
||||
scrollTop: top - myEleTop
|
||||
}, 'slow');
|
||||
});
|
||||
}else{
|
||||
$('#poster'+crc).slideUp();
|
||||
$carousel.flickity('playPlayer');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
$carousel = $(container+'.carousel').flickity();
|
||||
|
||||
$(container+".thumbsImage").attr('startModeFlix', 1);
|
||||
}
|
|
@ -21,6 +21,7 @@ TimeLogStart($timeLog);
|
|||
<link href="<?php echo $global['webSiteRootURL']; ?>view/js/webui-popover/jquery.webui-popover.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<?php echo $global['webSiteRootURL']; ?>plugin/YouPHPFlix2/view/js/flickity/flickity.min.css" rel="stylesheet" type="text/css" />
|
||||
<?php include $global['systemRootPath'] . 'view/include/head.php'; ?>
|
||||
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/infinite-scroll.pkgd.min.js" type="text/javascript"></script>
|
||||
<title><?php echo $config->getWebSiteTitle(); ?></title>
|
||||
</head>
|
||||
<body class="<?php echo $global['bodyClass']; ?>">
|
||||
|
@ -34,6 +35,40 @@ TimeLogStart($timeLog);
|
|||
<?php
|
||||
$_POST['current'] = 1;
|
||||
$_POST['rowCount'] = $obj->maxVideos;
|
||||
|
||||
TimeLogEnd($timeLog, __LINE__);
|
||||
if ($obj->Suggested) {
|
||||
$dataFlickirty = new stdClass();
|
||||
$dataFlickirty->wrapAround = true;
|
||||
$dataFlickirty->pageDots = !empty($obj->pageDots);
|
||||
$dataFlickirty->lazyLoad = 15;
|
||||
$dataFlickirty->setGallerySize = false;
|
||||
$dataFlickirty->cellAlign = 'left';
|
||||
if ($obj->SuggestedAutoPlay) {
|
||||
$dataFlickirty->autoPlay = true;
|
||||
}
|
||||
|
||||
$_POST['sort']['trending'] = "";
|
||||
//getAllVideos($status = "viewable", $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = array(), $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true, $suggestedOnly = false)
|
||||
$videos = Video::getAllVideos("viewableNotUnlisted", false, true, array(), false, false, true, true);
|
||||
unset($_POST['sort']['trending']);
|
||||
if (!empty($videos)) {
|
||||
?>
|
||||
<div class="row">
|
||||
<h2>
|
||||
<i class="glyphicon glyphicon-sort-by-attributes"></i> <?php
|
||||
echo __("Trending");
|
||||
?>
|
||||
</h2>
|
||||
<!-- Date Added -->
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'plugin/YouPHPFlix2/view/row.php';
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
TimeLogEnd($timeLog, __LINE__);
|
||||
if ($obj->Trending) {
|
||||
$dataFlickirty = new stdClass();
|
||||
|
@ -79,7 +114,7 @@ TimeLogStart($timeLog);
|
|||
$dataFlickirty->autoPlay = true;
|
||||
}
|
||||
|
||||
$_POST['sort']['created'] = "DESC";
|
||||
unset($_POST['sort']);
|
||||
|
||||
$videos = Video::getAllVideos("viewableNotUnlisted", false, true);
|
||||
if (!empty($videos)) {
|
||||
|
@ -167,81 +202,11 @@ TimeLogStart($timeLog);
|
|||
}
|
||||
TimeLogEnd($timeLog, __LINE__);
|
||||
if ($obj->Categories) {
|
||||
$dataFlickirty = new stdClass();
|
||||
$dataFlickirty->wrapAround = true;
|
||||
$dataFlickirty->pageDots = !empty($obj->pageDots);
|
||||
$dataFlickirty->lazyLoad = 15;
|
||||
$dataFlickirty->setGallerySize = false;
|
||||
$dataFlickirty->cellAlign = 'left';
|
||||
if ($obj->CategoriesAutoPlay) {
|
||||
$dataFlickirty->autoPlay = true;
|
||||
$dataFlickirty->wrapAround = true;
|
||||
} else {
|
||||
$dataFlickirty->wrapAround = true;
|
||||
}
|
||||
$searchPhrase = "";
|
||||
if (!empty($_POST['searchPhrase'])) {
|
||||
$searchPhrase = $_POST['searchPhrase'];
|
||||
unset($_POST['searchPhrase']);
|
||||
}
|
||||
unset($_POST['sort']);
|
||||
unset($_POST['rowCount']);
|
||||
$categories = Category::getAllCategories();
|
||||
$_POST['rowCount'] = $obj->maxVideos;
|
||||
$_POST['searchPhrase'] = $searchPhrase;
|
||||
$showAllVideos = false;
|
||||
if(!empty($_GET['catName'])){
|
||||
$showAllVideos = true;
|
||||
}
|
||||
foreach ($categories as $value) {
|
||||
$obj = AVideoPlugin::getObjectData("YouPHPFlix2");
|
||||
$timeLog2 = __FILE__." - Category {$value['clean_name']}";
|
||||
TimeLogStart($timeLog2);
|
||||
$oldCatName = @$_GET['catName'];
|
||||
if (!empty($_GET['catName']) && $value['clean_name'] !== $_GET['catName']) {
|
||||
continue;
|
||||
} else {
|
||||
$_GET['catName'] = $value['clean_name'];
|
||||
}
|
||||
unset($_POST['sort']);
|
||||
$_POST['sort']['v.created'] = "DESC";
|
||||
$_POST['sort']['likes'] = "DESC";
|
||||
$videos = Video::getAllVideos("viewableNotUnlisted", false, true);
|
||||
TimeLogEnd($timeLog2, __LINE__);
|
||||
if (empty($videos)) {
|
||||
$_GET['catName'] = $oldCatName;
|
||||
continue;
|
||||
}
|
||||
?>
|
||||
<div class="row">
|
||||
<span class="md-col-12"> </span>
|
||||
<h2>
|
||||
<a href="<?php echo $global['webSiteRootURL']; ?>cat/<?php echo $value['clean_name']; ?>"><i class="<?php echo $value['iconClass']; ?>"></i> <?php echo $value['name']; ?></a>
|
||||
</h2>
|
||||
<!-- Categories -->
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'plugin/YouPHPFlix2/view/row.php';
|
||||
|
||||
if($showAllVideos){
|
||||
while(1){
|
||||
$_POST['current']++;
|
||||
$videos = Video::getAllVideos("viewableNotUnlisted", false, true);
|
||||
if (empty($videos)) {
|
||||
break;
|
||||
}
|
||||
include $global['systemRootPath'] . 'plugin/YouPHPFlix2/view/row.php';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
$_GET['catName'] = $oldCatName;
|
||||
TimeLogEnd($timeLog2, __LINE__);
|
||||
}
|
||||
if (!empty($_GET['catName'])) {
|
||||
unset($_POST['sort']);
|
||||
$categories = Category::getChildCategoriesFromTitle($_GET['catName']);
|
||||
foreach ($categories as $value) {
|
||||
$categoriesC = Category::getChildCategoriesFromTitle($_GET['catName']);
|
||||
foreach ($categoriesC as $value) {
|
||||
unset($_POST['sort']);
|
||||
$_GET['catName'] = $value['clean_name'];
|
||||
$_POST['sort']['v.created'] = "DESC";
|
||||
|
@ -264,6 +229,50 @@ TimeLogStart($timeLog);
|
|||
<?php
|
||||
unset($_GET['catName']);
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<div id="categoriesContainer">
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'plugin/YouPHPFlix2/view/modeFlixCategory.php';
|
||||
?>
|
||||
</div>
|
||||
<p class="pagination">
|
||||
<a class="pagination__next" href="<?php echo $global['webSiteRootURL']; ?>plugin/YouPHPFlix2/view/modeFlixCategory.php?current=1"></a>
|
||||
</p>
|
||||
<div class="scroller-status">
|
||||
<div class="infinite-scroll-request loader-ellips text-center">
|
||||
<i class="fas fa-spinner fa-pulse text-muted"></i>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$container = $('#categoriesContainer').infiniteScroll({
|
||||
path: '.pagination__next',
|
||||
append: '.categoriesContainerItem',
|
||||
status: '.scroller-status',
|
||||
hideNav: '.pagination',
|
||||
history: false,
|
||||
checkLastPage: true
|
||||
});
|
||||
$container.on('request.infiniteScroll', function (event, path) {
|
||||
//console.log('Loading page: ' + path);
|
||||
});
|
||||
$container.on('append.infiniteScroll', function (event, response, path, items) {
|
||||
//console.log('Append page: ' + path);
|
||||
var id = "#" + items[0].id;
|
||||
startModeFlix(id + " ");
|
||||
|
||||
$(id + " img.thumbsJPG").each(function (index) {
|
||||
console.log($(this).attr('data-flickity-lazyload'));
|
||||
$(this).attr('src', $(this).attr('data-flickity-lazyload'));
|
||||
$(this).addClass('flickity-lazyloaded');
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
TimeLogEnd($timeLog, __LINE__);
|
||||
|
|
105
plugin/YouPHPFlix2/view/modeFlixCategory.php
Normal file
105
plugin/YouPHPFlix2/view/modeFlixCategory.php
Normal file
|
@ -0,0 +1,105 @@
|
|||
<?php
|
||||
global $global, $config;
|
||||
if (!isset($global['systemRootPath'])) {
|
||||
require_once '../../../videos/configuration.php';
|
||||
}
|
||||
require_once $global['systemRootPath'] . 'objects/video.php';
|
||||
require_once $global['systemRootPath'] . 'objects/category.php';
|
||||
|
||||
$_POST['rowCount'] = 2;
|
||||
if(empty($_GET['current'])){
|
||||
$_POST['current'] = 1;
|
||||
}else{
|
||||
$_POST['current'] = intval($_GET['current']);
|
||||
}
|
||||
|
||||
$obj = AVideoPlugin::getObjectData("YouPHPFlix2");
|
||||
$timeLog = __FILE__ . " - modeFlixCategory";
|
||||
|
||||
$uid = uniqid();
|
||||
?>
|
||||
<div class="categoriesContainerItem" id="<?php echo $uid; ?>">
|
||||
<?php
|
||||
TimeLogStart($timeLog);
|
||||
if ($obj->Categories) {
|
||||
$dataFlickirty = new stdClass();
|
||||
$dataFlickirty->wrapAround = true;
|
||||
$dataFlickirty->pageDots = !empty($obj->pageDots);
|
||||
$dataFlickirty->lazyLoad = true;
|
||||
$dataFlickirty->fade = true;
|
||||
$dataFlickirty->setGallerySize = false;
|
||||
$dataFlickirty->cellAlign = 'left';
|
||||
if ($obj->CategoriesAutoPlay) {
|
||||
$dataFlickirty->autoPlay = true;
|
||||
$dataFlickirty->wrapAround = true;
|
||||
} else {
|
||||
$dataFlickirty->wrapAround = true;
|
||||
}
|
||||
$searchPhrase = "";
|
||||
if (!empty($_POST['searchPhrase'])) {
|
||||
$searchPhrase = $_POST['searchPhrase'];
|
||||
unset($_POST['searchPhrase']);
|
||||
}
|
||||
unset($_POST['sort']);
|
||||
$_POST['rowCount'] = 2;
|
||||
$categories = Category::getAllCategories(false, true);
|
||||
$_POST['current']=1;
|
||||
$_POST['rowCount'] = $obj->maxVideos;
|
||||
$_POST['searchPhrase'] = $searchPhrase;
|
||||
$showAllVideos = false;
|
||||
if (!empty($_GET['catName'])) {
|
||||
$showAllVideos = true;
|
||||
}
|
||||
foreach ($categories as $value) {
|
||||
$obj = AVideoPlugin::getObjectData("YouPHPFlix2");
|
||||
$timeLog2 = __FILE__ . " - Category {$value['clean_name']}";
|
||||
TimeLogStart($timeLog2);
|
||||
$oldCatName = @$_GET['catName'];
|
||||
if (!empty($_GET['catName']) && $value['clean_name'] !== $_GET['catName']) {
|
||||
continue;
|
||||
} else {
|
||||
$_GET['catName'] = $value['clean_name'];
|
||||
}
|
||||
unset($_POST['sort']);
|
||||
$_POST['sort']['v.created'] = "DESC";
|
||||
$_POST['sort']['likes'] = "DESC";
|
||||
$videos = Video::getAllVideos("viewableNotUnlisted", false, true);
|
||||
TimeLogEnd($timeLog2, __LINE__);
|
||||
if (empty($videos)) {
|
||||
$_GET['catName'] = $oldCatName;
|
||||
continue;
|
||||
}
|
||||
?>
|
||||
<div class="row">
|
||||
<span class="md-col-12"> </span>
|
||||
<h2>
|
||||
<a href="<?php echo $global['webSiteRootURL']; ?>cat/<?php echo $value['clean_name']; ?>"><i class="<?php echo $value['iconClass']; ?>"></i> <?php echo $value['name']; ?></a>
|
||||
</h2>
|
||||
<!-- Categories -->
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'plugin/YouPHPFlix2/view/row.php';
|
||||
|
||||
if ($showAllVideos) {
|
||||
while (1) {
|
||||
$_POST['current'] ++;
|
||||
$videos = Video::getAllVideos("viewableNotUnlisted", false, true);
|
||||
if (empty($videos)) {
|
||||
break;
|
||||
}
|
||||
include $global['systemRootPath'] . 'plugin/YouPHPFlix2/view/row.php';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
$_GET['catName'] = $oldCatName;
|
||||
TimeLogEnd($timeLog2, __LINE__);
|
||||
}
|
||||
}
|
||||
TimeLogEnd($timeLog, __LINE__);
|
||||
|
||||
?>
|
||||
</div>
|
||||
<p class="pagination">
|
||||
<a class="pagination__next" href="<?php echo $global['webSiteRootURL']; ?>plugin/YouPHPFlix2/view/modeFlixCategory.php?current=<?php echo count($categories)?$_POST['current'] + 1:$_POST['current']; ?>"></a>
|
||||
</p>
|
Loading…
Add table
Add a link
Reference in a new issue