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

Return channels on the default gallery search

This commit is contained in:
Daniel 2022-02-08 14:28:39 -03:00
parent 754f61d516
commit 1fee8b996f
7 changed files with 119 additions and 65 deletions

View file

@ -2010,9 +2010,9 @@ function make_path($path) {
}
if (!is_dir($path)) {
//if(preg_match('/getvideoinfo/i', $path)){var_dump(debug_backtrace());}
if(preg_match('/cache/i', $path)){
if (preg_match('/cache/i', $path)) {
$mode = 0777;
}else{
} else {
$mode = 0755;
}
$created = mkdir($path, $mode, true);
@ -5646,14 +5646,14 @@ function forbiddenPage($message = '', $logMessage = false, $unlockPassword = '',
break;
}
}
if(empty($unlockPassword) && preg_match('/json/i', $contentType)){
if (empty($unlockPassword) && preg_match('/json/i', $contentType)) {
header("Content-Type: application/json");
$obj = new stdClass();
$obj->error = true;
$obj->msg = $message;
$obj->forbiddenPage = true;
die(json_encode($obj));
}else{
} else {
header("Content-Type: text/html");
include $global['systemRootPath'] . 'view/forbiddenPage.php';
}
@ -6373,14 +6373,31 @@ function getSocialModal($videos_id, $url = "", $title = "") {
function getCroppie(
$buttonTitle,
$callBackJSFunction,
$resultWidth,
$resultHeight,
$resultWidth = 0,
$resultHeight = 0,
$viewportWidth = 0,
$boundary = 25,
$viewportHeight = 0,
$enforceBoundary = true
) {
global $global;
if (empty($resultWidth) && empty($resultHeight)) {
if (isMobile()) {
$viewportWidth = 250;
} else {
$viewportWidth = 800;
}
if (defaultIsPortrait()) {
$resultWidth = 540;
$resultHeight = 800;
} else {
$resultWidth = 1280;
$resultHeight = 720;
}
}
if (empty($viewportWidth)) {
$viewportWidth = $resultWidth;
}

View file

@ -292,7 +292,8 @@ class Subscribe
$sql .= " AND users_id = '{$user_id}' ";
}
$sql .= BootGrid::getSqlSearchFromPost(['email']);
//$sql .= BootGrid::getSqlSearchFromPost(['email']);
//echo $sql, '<br>', PHP_EOL;
$res = sqlDAL::readSql($sql);
$numRows = sqlDAL::num_rows($res);
sqlDAL::close($res);
@ -357,7 +358,7 @@ class Subscribe
if (!empty($advancedCustom->removeSubscribeButton)) {
return "";
}
$rowCount = getRowCount();
$total = static::getTotalSubscribes($user_id);
$btnFile = $global['systemRootPath'] . 'view/subscribeBtnOffline.html';

View file

@ -1,5 +1,4 @@
<?php
require_once __DIR__ . DIRECTORY_SEPARATOR . 'autoload.php';
if (empty($global['systemRootPath'])) {
@ -2569,4 +2568,52 @@ if (typeof gtag !== \"function\") {
return $user->addExternalOptions('ProfilePassword', preg_replace('/[^0-9a-z]/i', '', $value));
}
static function getChannelPanel($users_id) {
$u = new User($users_id);
$get = ['channelName' => $u->getChannelName()];
?>
<div class="panel panel-default">
<div class="panel-heading" style="position: relative;">
<img src="<?php echo User::getPhoto($users_id); ?>"
class="img img-thumbnail img-responsive pull-left" style="max-height: 100px; margin: 0 10px;" alt="User Photo" />
<a href="<?php echo User::getChannelLink($users_id); ?>" class="btn btn-default">
<i class="fas fa-play-circle"></i>
<?php echo User::getNameIdentificationById($users_id); ?>
</a>
<div style="position: absolute; right: 10px; top: 10px;">
<?php echo User::getBlockUserButton($users_id); ?>
<?php echo Subscribe::getButton($users_id); ?>
</div>
</div>
<div class="panel-body gallery ">
<div style="margin-left: 120px;">
<?php echo stripslashes(str_replace('\\\\\\\n', '<br/>', html_entity_decode($value['about']))); ?>
</div>
<div class="clearfix" style="margin-bottom: 10px;"></div>
<div class="clear clearfix galeryRowElement">
<?php
$current = getCurrentPage();
$rowCount = getRowCount();
$sort = $_POST['sort'];
$_POST['current'] = 1;
$_REQUEST['rowCount'] = 6;
$_POST['sort']['created'] = "DESC";
$uploadedVideos = Video::getAllVideos("viewable", $users_id);
createGallerySection($uploadedVideos, dechex(crc32($users_id)));
$_POST['current'] = $current;
$_REQUEST['rowCount'] = $rowCount;
$_POST['sort'] = $sort;
?>
</div>
</div>
<div class="panel-footer " style="font-size: 0.8em">
<div class=" text-muted align-right">
<?php echo number_format_short(VideoStatistic::getChannelsTotalViews($users_id)), " ", __("Views in the last 30 days"); ?>
</div>
</div>
</div>
<?php
}
}

View file

@ -5007,6 +5007,9 @@ if (!class_exists('Video')) {
public static function getCreatorHTML($users_id, $html = '', $small = false, $ignoreLinks=false)
{
if(empty($users_id)){
return '';
}
global $global;
if ($small) {
$template = $global['systemRootPath'] . 'view/videoCreatorSmall.html';

View file

@ -2,6 +2,7 @@
require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php';
require_once $global['systemRootPath'] . 'plugin/AVideoPlugin.php';
require_once $global['systemRootPath'] . 'objects/Channel.php';
class Gallery extends PluginAbstract {

View file

@ -22,20 +22,43 @@
echo '<center style="margin:5px;">' . getAdsLeaderBoardTop2() . '</center>';
if (empty($_GET['catName'])) {
$objLive = AVideoPlugin::getDataObject('Live');
if(empty($objLive->doNotShowLiveOnVideosList)){
?>
<!-- For Live Videos -->
<div id="liveVideos" class="clear clearfix" style="display: none;">
<h3 class="galleryTitle text-danger"> <i class="fas fa-play-circle"></i> <?php echo __("Live"); ?></h3>
<div class="extraVideos"></div>
</div>
<!-- For Live Schedule Videos -->
<div id="liveScheduleVideos" class="clear clearfix" style="display: none;">
<h3 class="galleryTitle"> <i class="far fa-calendar-alt"></i> <?php echo __($objLive->live_schedule_label); ?></h3>
<div class="extraVideos"></div>
</div>
<!-- For Live Videos End -->
<?php
if (empty($objLive->doNotShowLiveOnVideosList)) {
?>
<!-- For Live Videos -->
<div id="liveVideos" class="clear clearfix" style="display: none;">
<h3 class="galleryTitle text-danger"> <i class="fas fa-play-circle"></i> <?php echo __("Live"); ?></h3>
<div class="extraVideos"></div>
</div>
<!-- For Live Schedule Videos -->
<div id="liveScheduleVideos" class="clear clearfix" style="display: none;">
<h3 class="galleryTitle"> <i class="far fa-calendar-alt"></i> <?php echo __($objLive->live_schedule_label); ?></h3>
<div class="extraVideos"></div>
</div>
<!-- For Live Videos End -->
<?php
}
if (!empty($_REQUEST['search'])) {
$users_id_array = VideoStatistic::getUsersIDFromChannelsWithMoreViews();
$channels = Channel::getChannels(true, "u.id, '" . implode(",", $users_id_array) . "'");
if (!empty($channels)) {
?>
<div id="channelsResults" class="clear clearfix">
<h3 class="galleryTitle"> <i class="fas fa-user"></i> <?php echo __('Channels'); ?></h3>
<div class="row">
<?php
$search = $_REQUEST['search'];
clearSearch();
foreach ($channels as $value) {
echo '<div class="col-sm-12">';
User::getChannelPanel($value['id']);
echo '</div>';
}
reloadSearch();
?>
</div>
</div>
<?php
}
}
}
echo AVideoPlugin::getGallerySection();
@ -75,16 +98,16 @@
include $global['systemRootPath'] . 'plugin/Gallery/view/mainAreaChannels.php';
} else
if ($value['name'] == 'Categories' && empty($_GET['showOnly'])) {
if(empty($currentCat) && !empty(getSearchVar())){
if (empty($currentCat) && !empty(getSearchVar())) {
$onlySuggested = $obj->CategoriesShowOnlySuggested;
cleanSearchVar();
$categories = Category::getAllCategories(false, true, $onlySuggested);
reloadSearchVar();
reloadSearchVar();
foreach ($categories as $value) {
$currentCat = $value['clean_name'];
include $global['systemRootPath'] . 'plugin/Gallery/view/modeGalleryCategory.php';
}
}else{
} else {
include $global['systemRootPath'] . 'plugin/Gallery/view/modeGalleryCategory.php';
}
}

View file

@ -102,45 +102,7 @@ $metaDescription = __("Channels");
</ul>
<?php
foreach ($channels as $value) {
$get = ['channelName' => $value['channelName']]; ?>
<div class="panel panel-default">
<div class="panel-heading" style="position: relative;">
<img src="<?php echo User::getPhoto($value['id']); ?>"
class="img img-thumbnail img-responsive pull-left" style="max-height: 100px; margin: 0 10px;" alt="User Photo" />
<a href="<?php echo User::getChannelLink($value['id']); ?>" class="btn btn-default">
<i class="fas fa-play-circle"></i>
<?php
echo User::getNameIdentificationById($value['id']); ?>
</a>
<div style="position: absolute; right: 10px; top: 10px;">
<?php
echo User::getBlockUserButton($value['id']); ?>
<?php echo Subscribe::getButton($value['id']); ?>
</div>
</div>
<div class="panel-body gallery ">
<div style="margin-left: 120px;">
<?php echo stripslashes(str_replace('\\\\\\\n', '<br/>', html_entity_decode($value['about']))); ?>
</div>
<div class="clearfix" style="margin-bottom: 10px;"></div>
<div class="clear clearfix galeryRowElement">
<?php
$_POST['current'] = 1;
$_REQUEST['rowCount'] = 6;
$_POST['sort']['created'] = "DESC";
$uploadedVideos = Video::getAllVideos("viewable", $value['id']);
createGallerySection($uploadedVideos, dechex(crc32($value['channelName']))); ?>
</div>
</div>
<div class="panel-footer " style="font-size: 0.8em">
<div class=" text-muted align-right">
<?php echo number_format_short(VideoStatistic::getChannelsTotalViews($value['id'])), " ", __("Views in the last 30 days"); ?>
</div>
</div>
</div>
<?php
User::getChannelPanel($value['id']);
}
echo getPagination($totalPages, $current, "{$global['webSiteRootURL']}channels?page={page}");