1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00
This commit is contained in:
Daniel Neto 2023-12-20 12:02:08 -03:00
parent 4beef95ecd
commit 5717da4eb3
10 changed files with 221 additions and 7 deletions

View file

@ -13,6 +13,9 @@ function includeLangFile() {
if(empty($_SESSION)){
_session_start();
}
if(empty($_SESSION['language'])){
$_SESSION['language'] = '';
}
$_SESSION['language'] = str_replace('../', '', $_SESSION['language']);
setSiteLang();
@include_once "{$global['systemRootPath']}locale/{$_SESSION['language']}.php";

View file

@ -17,6 +17,7 @@ $obj->PHPSESSID = session_id();
$obj->version = $config->getVersion();
$obj->mobileSreamerVersion = MobileManager::getVersion();
$obj->reportVideoPluginEnabled = AVideoPlugin::isEnabledByName("ReportVideo");
$obj->oauthLogin = [];
$obj->oauthLogin[] = ['type' => 'Facebook', 'status'=> !empty(AVideoPlugin::loadPluginIfEnabled('LoginFacebook'))];
$obj->oauthLogin[] = ['type' => 'Google', 'status'=> !empty(AVideoPlugin::loadPluginIfEnabled('LoginGoogle'))];

View file

@ -33,7 +33,7 @@ $obj = new Video($_POST['title'], "", @$_POST['id'], true);
TimeLogEnd(__FILE__, __LINE__);
$obj->setClean_Title($_POST['clean_title']);
$obj->setClean_Title(@$_POST['clean_title']);
$audioLinks = ['mp3', 'ogg'];
$videoLinks = ['mp4', 'webm', 'm3u8'];
TimeLogEnd(__FILE__, __LINE__);

View file

@ -739,6 +739,9 @@ Disallow: *action=tagsearch*
}
$video = new Video('', '', $videos_id, true);
$externalOptions = _json_decode($video->getExternalOptions());
if(!is_object($externalOptions)){
$externalOptions = new stdClass();
}
$externalOptions->redirectVideo = array('code'=>$code, 'url'=>$url);
$video->setExternalOptions(json_encode($externalOptions));
return $video->save();

View file

@ -983,4 +983,15 @@ class CustomizeUser extends PluginAbstract
include $global['systemRootPath'] . 'plugin/CustomizeUser/View/footer.php';
return '';
}
public function getMobileInfo() {
$obj = $this->getDataObject();
$return = new stdClass();
$return->userCanChangeVideoOwner = $obj->userCanChangeVideoOwner;
$return->usersCanCreateNewCategories = $obj->usersCanCreateNewCategories;
$return->userCanNotChangeCategory = $obj->userCanNotChangeCategory;
$return->userCanNotChangeUserGroup = $obj->userCanNotChangeUserGroup;
return $return;
}
}

View file

@ -176,6 +176,10 @@ class Playlists_schedules extends ObjectYPT
public function save()
{
if(empty($this->playlists_id)){
_error_log("Playlists_schedules::save playlists_id is empty");
return false;
}
if (empty($this->status)) {
$this->status = self::STATUS_ACTIVE;
}

View file

@ -189,7 +189,7 @@ class VideoTags extends PluginAbstract {
$str = '<input type="text" value="" id="inputTags' . $tagTypesId . '"/>
<script>
$(document).ready(function () {
var citynames' . $tagTypesId . ' = new Bloodhound({
var videoTags' . $tagTypesId . ' = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace(\'name\'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: {
@ -200,17 +200,17 @@ var citynames' . $tagTypesId . ' = new Bloodhound({
}
}
});
citynames' . $tagTypesId . '.initialize();
videoTags' . $tagTypesId . '.initialize();
$(\'#inputTags' . $tagTypesId . '\').tagsinput({
maxTags: ' . $obj->maxTags . ',
maxChars: ' . $obj->maxChars . ',
trimValue: true,
typeaheadjs: {
name: \'citynames\',
name: \'videoTags\',
displayKey: \'name\',
valueKey: \'name\',
source: citynames' . $tagTypesId . '.ttAdapter()
source: videoTags' . $tagTypesId . '.ttAdapter()
},
freeInput: ' . (self::canCreateTag() ? "true" : "false") . '
});
@ -465,7 +465,7 @@ $(\'#inputTags' . $tagTypesId . '\').tagsinput({
public static function getManagerVideosJavaScripts() {
global $global;
return "<script src=\"" . getCDN() . "plugin/VideoTags/bootstrap-tagsinput/bootstrap-tagsinput.min.js\" type=\"text/javascript\"></script><script src=\"" . getCDN() . "plugin/VideoTags/bootstrap-tagsinput/typeahead.bundle.js\" type=\"text/javascript\"></script>";
return "<script src=\"" . getURL('plugin/VideoTags/bootstrap-tagsinput/bootstrap-tagsinput.min.js') . "\" type=\"text/javascript\"></script><script src=\"" . getURL('plugin/VideoTags/bootstrap-tagsinput/typeahead.bundle.js') . "\" type=\"text/javascript\"></script>";
}
public static function saveVideosAddNew($post, $videos_id) {
@ -519,4 +519,11 @@ $(\'#inputTags' . $tagTypesId . '\').tagsinput({
$js .= '<script src="' .getURL('plugin/VideoTags/View/script.js') . '" type="text/javascript"></script>';
return $js;
}
public function getMobileInfo() {
$obj = $this->getDataObject();
$return = new stdClass();
$return->videoTagsTypes = TagsTypes::getAll();
return $return;
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,180 @@
<?php
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
$videos_id = @$_REQUEST['videos_id'];
if (empty($videos_id)) {
forbiddenPage('Videos ID empty');
}
if (!Video::canEdit($videos_id)) {
forbiddenPage('You cannot edit this video');
}
$isVideoTagsEnabled = AVideoPlugin::isEnabledByName('VideoTags');
$video = new Video('', '', $videos_id);
$title = $video->getTitle();
$description = $video->getDescription();
$categories_id = $video->getCategories_id();
$_page = new Page(array('Edit Video', $title));
if ($isVideoTagsEnabled) {
$_page->setExtraScripts(
array(
'plugin/VideoTags/bootstrap-tagsinput/bootstrap-tagsinput.min.js',
'plugin/VideoTags/bootstrap-tagsinput/typeahead.bundle.js',
)
);
}
?>
<div class="container-fluid">
<div class="panel panel-default ">
<div class="panel-heading clearfix ">
<h1 class="pull-left">
<?php
echo $title;
?>
</h1>
</div>
<div class="panel-body">
<div class="row">
<div class="col-sm-6">
<?php
$images = Video::getImageFromID($videos_id);
if (isMobile()) {
$viewportWidth = 250;
} else {
$viewportWidth = 800;
}
if (defaultIsPortrait()) {
$width = 540;
$height = 800;
$path = $images->posterPortraitPath;
$portrait = 1;
} else {
$width = 1280;
$height = 720;
$path = empty($images->posterLandscapePath) ? ImagesPlaceHolders::getVideoPlaceholder(ImagesPlaceHolders::$RETURN_PATH) : $images->posterLandscapePath;
$portrait = 0;
}
$image = str_replace([$global['systemRootPath'], DIRECTORY_SEPARATOR], [$global['webSiteRootURL'], '/'], $path);
$image = addQueryStringParameter($image, 'cache', filectime($path));
//var_dump($image, $images);exit;
$croppie1 = getCroppie(__("Upload Poster"), "saveVideo", $width, $height, $viewportWidth);
echo $croppie1['html'];
?>
</div>
<div class="col-sm-6">
<div class="row">
<div class="form-group col-sm-6">
<label for="title"><?php echo __('Title'); ?></label>
<input type="text" class="form-control" id="title" placeholder="<?php echo __('Title'); ?>" value="<?php echo $title; ?>">
</div>
<div class="form-group col-sm-6">
<label for="categories_id"><?php echo __('Categories'); ?></label>
<?php echo Layout::getCategorySelect('categories_id', $categories_id, 'categories_id'); ?>
</div>
<div class="form-group col-sm-12">
<label for="description"><?php echo __('Description'); ?></label>
<textarea class="form-control" id="description" rows="10"><?php echo $description; ?></textarea>
<?php
echo ("<script>window.videos_id={$videos_id}</script>");
if (empty($advancedCustom->disableHTMLDescription)) {
echo getTinyMCE("description");
}
?>
</div>
</div>
</div>
<?php
if ($isVideoTagsEnabled) {
?>
<div class="col-sm-12">
<?php
echo VideoTags::getTagsInputs();
//$('#inputTags' + row.videoTags[i].tag_types_id).tagsinput('add', row.videoTags[i].name);
?>
</div>
<?php
}
?>
</div>
<div class="panel-footer">
<button class="btn btn-success btn-lg btn-block" onclick="saveVideo(true);"><i class="fas fa-save"></i> <?php echo __('Save'); ?></button>
</div>
</div>
</div>
</div>
<script>
var closeWindowAfterImageSave = false;
var modalimage = getPleaseWait();
var modalmeta = getPleaseWait();
function saveVideo(image) {
modalimage.showPleaseWait();
$.ajax({
url: webSiteRootURL + 'objects/videoEditLight.php',
data: {
videos_id: <?php echo $videos_id; ?>,
image: image,
portrait: <?php echo $portrait; ?>,
},
type: 'post',
success: function(response) {
modalimage.hidePleaseWait();
avideoResponse(response);
if (response && !response.error) {
saveVideoMeta(closeWindowAfterImageSave);
}
}
});
}
function saveVideoMeta(close) {
modalmeta.showPleaseWait();
$.ajax({
url: webSiteRootURL + 'objects/videoEditLight.php',
data: {
videos_id: <?php echo $videos_id; ?>,
title: $('#title').val(),
categories_id: $('#categories_id').val(),
description: <?php
if (empty($advancedCustom->disableHTMLDescription)) {
echo 'tinymce.get(\'description\').getContent()';
} else {
echo '$(\'#description\').val()';
}
?>
},
type: 'post',
success: function(response) {
modalmeta.hidePleaseWait();
avideoResponse(response);
if (response && !response.error) {
if (close) {
avideoModalIframeClose();
}
}
}
});
}
$(document).ready(function() {
setupFormElement('#title', 35, 65, true, true);
<?php
echo $croppie1['createCroppie'] . "('{$image}');";
?>
});
</script>
<?php
$_page->print();
?>

View file

@ -37,6 +37,7 @@ if (!empty($playlist_id)) {
<?php
} elseif (empty($autoPlayVideo)) {
?>
<!-- Line <?php echo __LINE__; ?> -->
<div class="col-lg-12 col-sm-12 col-xs-12 autoplay text-muted" style="margin: 10px 0;">
<strong><?php echo __("Autoplay ended"); ?></strong>
<span class="pull-right">
@ -52,6 +53,7 @@ if (!empty($playlist_id)) {
</div>
<?php
} elseif (!empty($autoPlayVideo) && PlayerSkins::showAutoplay()) { ?>
<!-- Line <?php echo __LINE__; ?> -->
<div class="row">
<div class="col-lg-12 col-sm-12 col-xs-12 autoplay text-muted" style="margin: 10px 0;">
<strong><?php echo __("Up Next"); ?></strong>