1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 09:49:28 +02:00

Version 8.3 and mail fix

This commit is contained in:
daniel 2020-01-20 17:38:11 -03:00
parent ee4cd23aea
commit 3b13f66fce
72 changed files with 288 additions and 140 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

View file

@ -4,7 +4,7 @@ if (file_exists("../videos/configuration.php")) {
exit;
}
$installationVersion = "8.2";
$installationVersion = "8.3";
header('Content-Type: application/json');

View file

@ -136,6 +136,7 @@ CREATE TABLE IF NOT EXISTS `videos` (
`only_for_paid` TINYINT(1) NULL DEFAULT NULL,
`serie_playlists_id` INT(11) NULL DEFAULT NULL,
`sites_id` INT(11) NULL,
`video_password` VARCHAR(45) NULL DEFAULT NULL,
PRIMARY KEY (`id`),
INDEX `fk_videos_users_idx` (`users_id` ASC),
INDEX `fk_videos_categories1_idx` (`categories_id` ASC),

View file

@ -4,7 +4,7 @@ require_once $global['systemRootPath'] . 'objects/functions.php';
// filter some security here
$securityFilter = array('error', 'catName', 'type', 'channelName', 'captcha', 'showOnly', 'key', 'link', 'email', 'country', 'region');
$securityFilterInt = array('videos_id', 'video_id', 'categories_id', 'user_id', 'users_id', 'comments_id', 'isAdmin', 'priority', 'totalClips');
$securityRemoveSingleQuotes = array('search', 'searchPhrase', 'videoName', 'databaseName', 'sort', 'user', 'pass', 'encodedPass', 'isAdmin');
$securityRemoveSingleQuotes = array('search', 'searchPhrase', 'videoName', 'databaseName', 'sort', 'user', 'pass', 'encodedPass', 'isAdmin', 'videoLink', 'video_password');
$securityRemoveNonChars = array('resolution', 'format', 'videoDirectory');
$filterURL = array('videoURL', 'siteURL');

View file

@ -3,7 +3,7 @@ require_once '../videos/configuration.php';
$images = Video::getImageFromFilename($video['filename']);
$img = $images->poster;
if (!empty($images->posterPortrait)) {
if (!empty($images->posterPortrait) && strpos($images->posterPortrait, 'notfound_portrait') === false) {
$img = $images->posterPortrait;
}
$imgw = 1280;
@ -28,6 +28,12 @@ $imgh = 720;
<meta property="video:duration" content="<?php echo Video::getItemDurationSeconds($video['duration']); ?>" />
<meta property="duration" content="<?php echo Video::getItemDurationSeconds($video['duration']); ?>" />
<style>
body {
padding-top: 0;
}
footer{
display: none;
}
#bg{
position: fixed;
width: 100%;
@ -41,7 +47,7 @@ $imgh = 720;
</head>
<body class="<?php echo $global['bodyClass']; ?>">
<?php
include $global['systemRootPath'] . 'view/include/navbar.php';
//include $global['systemRootPath'] . 'view/include/navbar.php';
?>
<div id="bg"></div>
@ -71,7 +77,7 @@ $imgh = 720;
<div class="modal-footer" >
<a href="<?php echo $_SERVER['REQUEST_URI'],strpos($_SERVER['REQUEST_URI'], "?")===false?"?":"&"; ?>rrating=1" class="btn btn-success pull-right"><i class="fas fa-check-circle"></i> <?php echo __("Confirm"); ?></a>
<a href="<?php echo $global["HTTP_REFERER"]; ?>" class="btn btn-danger pull-right"><i class="fas fa-times-circle"></i> <?php echo __("Cancel"); ?></a>
<a href="<?php echo $global['webSiteRootURL']; ?>" class="btn btn-danger pull-right"><i class="fas fa-times-circle"></i> <?php echo __("Cancel"); ?></a>
</div>
</div>

View file

@ -0,0 +1,108 @@
<?php
require_once '../videos/configuration.php';
$images = Video::getImageFromFilename($video['filename']);
$img = $images->poster;
if (!empty($images->posterPortrait) && strpos($images->posterPortrait, 'notfound_portrait') === false) {
$img = $images->posterPortrait;
}
$imgw = 1280;
$imgh = 720;
?>
<!DOCTYPE html>
<html lang="<?php echo $_SESSION['language']; ?>">
<head>
<title><?php echo $config->getWebSiteTitle(); ?> :: Confirm Rating</title>
<?php
include $global['systemRootPath'] . 'view/include/head.php';
?>
<link rel="image_src" href="<?php echo $img; ?>" />
<meta property="fb:app_id" content="774958212660408" />
<meta property="og:url" content="<?php echo $global['webSiteRootURL'], "video/", $video['clean_title']; ?>" />
<meta property="og:type" content="video.other" />
<meta property="og:title" content="<?php echo str_replace('"', '', $video['title']); ?> - <?php echo $config->getWebSiteTitle(); ?>" />
<meta property="og:description" content="<?php echo!empty($custom) ? $custom : str_replace('"', '', $video['title']); ?>" />
<meta property="og:image" content="<?php echo $img; ?>" />
<meta property="og:image:width" content="<?php echo $imgw; ?>" />
<meta property="og:image:height" content="<?php echo $imgh; ?>" />
<meta property="video:duration" content="<?php echo Video::getItemDurationSeconds($video['duration']); ?>" />
<meta property="duration" content="<?php echo Video::getItemDurationSeconds($video['duration']); ?>" />
<style>
body {
padding-top: 0;
}
footer{
display: none;
}
#bg{
position: fixed;
width: 100%;
height: 100%;
background-image: url('<?php echo $images->poster; ?>');
background-size: cover;
opacity: 0.3;
filter: alpha(opacity=30); /* For IE8 and earlier */
}
</style>
</head>
<body class="<?php echo $global['bodyClass']; ?>">
<?php
//include $global['systemRootPath'] . 'view/include/navbar.php';
?>
<div id="bg"></div>
<!-- Modal -->
<div id="myModal" class="modal fade in" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Title: <?php echo $video['title']; ?></h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-6">
<img src="<?php echo $img; ?>" class="img img-responsive"/>
</div>
<div class="col-sm-6">
<center>
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
<?php
if (!empty($_POST['video_password'])) {
?>
<div class="alert alert-danger"><?php echo __("Your password does not match!"); ?></div>
<?php
}
?>
<div class="form-group">
<label for="video_password"><?php echo __("This Video Requires a Password"); ?></label>
<input type="text" class="form-control" id="video_password" name="video_password" placeholder="<?php echo __("Password"); ?>" required>
</div>
<div class="row">
<div class="col-md-6">
<button type="submit" class="btn btn-success btn-block"><i class="fas fa-check-circle"></i> <?php echo __("Confirm"); ?></button>
</div>
<div class="col-md-6">
<a href="<?php echo $global['webSiteRootURL']; ?>" class="btn btn-danger btn-block"><i class="fas fa-times-circle"></i> <?php echo __("Cancel"); ?></a>
</div>
</div>
</form>
</center>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
include $global['systemRootPath'] . 'view/include/footer.php';
?>
<script type="text/javascript">
$(window).on('load', function () {
$('#myModal').modal('show');
});
</script>
</body>
</html>

View file

@ -111,7 +111,7 @@ function createOrderInfo($getName, $mostWord, $lessWord, $orderString) {
}
function createGallerySection($videos, $crc = "", $get = array()) {
global $global, $config, $obj, $advancedCustom;
global $global, $config, $obj, $advancedCustom, $advancedCustomUser;
$countCols = 0;
$obj = AVideoPlugin::getObjectData("Gallery");
$zindex = 1000;
@ -182,7 +182,7 @@ function createGallerySection($videos, $crc = "", $get = array()) {
<div class="text-muted galeryDetails" style="overflow: hidden;">
<div>
<?php if (empty($_GET['catName'])) { ?>
<?php if (empty($_GET['catName'])) { ?>
<a class="label label-default" href="<?php echo $global['webSiteRootURL']; ?>cat/<?php echo $value['clean_category']; ?>/">
<?php
if (!empty($value['iconClass'])) {
@ -191,7 +191,7 @@ function createGallerySection($videos, $crc = "", $get = array()) {
<?php
}
?>
<?php echo $value['category']; ?>
<?php echo $value['category']; ?>
</a>
<?php } ?>
<?php
@ -224,165 +224,180 @@ function createGallerySection($videos, $crc = "", $get = array()) {
<div>
<i class="fa fa-eye"></i>
<span itemprop="interactionCount">
<?php echo number_format($value['views_count'], 0); ?> <?php echo __("Views"); ?>
<?php echo number_format($value['views_count'], 0); ?> <?php echo __("Views"); ?>
</span>
</div>
<?php } ?>
<div>
<i class="far fa-clock"></i>
<?php echo humanTiming(strtotime($value['videoCreation'])), " ", __('ago'); ?>
</div>
<div>
<i class="fa fa-user"></i>
<a class="text-muted" href="<?php echo User::getChannelLink($value['users_id']); ?>/">
<?php echo $name; ?>
</a>
<?php
if ((!empty($value['description'])) && !empty($obj->Description)) {
$desc = str_replace(array('"', "'", "#", "/"), array('``', "`", "", ""), preg_replace("/\r|\n/", "", nl2br(trim($value['description']))));
if (!empty($desc)) {
<?php } ?>
<?php
if (!empty($advancedCustomUser->userCanProtectVideosWithPassword)) {
?>
<div>
<?php
if (!empty($value['video_password'])) {
?>
<a href="#" onclick='swal({html: true, title: "<?php echo str_replace(array('"'), array('``'), $value['title']); ?>", text: "<div style=\"max-height: 300px; overflow-y: scroll;overflow-x: hidden;\"><?php echo $desc; ?></div>"});return false;' ><i class="far fa-file-alt"></i> <?php echo __("Description"); ?></a>
<i class="fas fa-lock" title="<?php echo __("Password Protected"); ?>" ></i>
<?php
}
}
?>
</div>
<?php if (Video::canEdit($value['id'])) { ?>
<div>
<a href="<?php echo $global['webSiteRootURL']; ?>mvideos?video_id=<?php echo $value['id']; ?>" class="text-primary">
<i class="fa fa-edit"></i> <?php echo __("Edit Video"); ?>
</a>
</div>
<?php }
?>
<?php } ?>
<div>
<i class="far fa-clock"></i>
<?php echo humanTiming(strtotime($value['videoCreation'])), " ", __('ago'); ?>
</div>
<div>
<i class="fa fa-user"></i>
<a class="text-muted" href="<?php echo User::getChannelLink($value['users_id']); ?>/">
<?php echo $name; ?>
</a>
<?php
echo AVideoPlugin::getGalleryActionButton($value['id']);
if ((!empty($value['description'])) && !empty($obj->Description)) {
$desc = str_replace(array('"', "'", "#", "/"), array('``', "`", "", ""), preg_replace("/\r|\n/", "", nl2br(trim($value['description']))));
if (!empty($desc)) {
?>
<a href="#" onclick='swal({html: true, title: "<?php echo str_replace(array('"'), array('``'), $value['title']); ?>", text: "<div style=\"max-height: 300px; overflow-y: scroll;overflow-x: hidden;\"><?php echo $desc; ?></div>"});return false;' ><i class="far fa-file-alt"></i> <?php echo __("Description"); ?></a>
<?php
}
}
?>
</div>
<?php if (Video::canEdit($value['id'])) { ?>
<div>
<a href="<?php echo $global['webSiteRootURL']; ?>mvideos?video_id=<?php echo $value['id']; ?>" class="text-primary">
<i class="fa fa-edit"></i> <?php echo __("Edit Video"); ?>
</a>
</div>
<?php }
?>
<?php
@$timesG[__LINE__] += microtime(true) - $startG;
$startG = microtime(true);
if (CustomizeUser::canDownloadVideosFromVideo($value['id'])) {
@$timesG[__LINE__] += microtime(true) - $startG;
$startG = microtime(true);
$files = getVideosURL($value['filename']);
@$timesG[__LINE__] += microtime(true) - $startG;
$startG = microtime(true);
if (!(!empty($files['m3u8']) && empty($files['mp4']))) {
?>
<div style="position: relative; overflow: visible; z-index: 3;" class="dropup">
<button type="button" class="btn btn-default btn-sm btn-xs btn-block" data-toggle="dropdown">
<i class="fa fa-download"></i> <?php echo!empty($advancedCustom->uploadButtonDropdownText) ? $advancedCustom->uploadButtonDropdownText : ""; ?> <span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-left" role="menu">
<?php
//var_dump($files);exit;
foreach ($files as $key => $theLink) {
if (($theLink['type'] !== 'video' && $theLink['type'] !== 'audio') || $key == "m3u8") {
continue;
}
$path_parts = pathinfo($theLink['filename']);
?>
<li>
<a href="<?php echo $theLink['url']; ?>?download=1&title=<?php echo urlencode($value['title'] . "_{$key}_.{$path_parts['extension']}"); ?>">
<?php echo __("Download"); ?> <?php echo $key; ?>
</a>
</li>
<?php }
?>
</ul>
</div>
<?php
}
}
@$timesG[__LINE__] += microtime(true) - $startG;
$startG = microtime(true);
getLdJson($value['id']);
getItemprop($value['id']);
echo AVideoPlugin::getGalleryActionButton($value['id']);
?>
</div>
<?php
}
?>
<div class="col-xs-12 text-center clear clearfix" style="padding: 10px;">
<?php echo getAdsLeaderBoardMiddle(); ?>
@$timesG[__LINE__] += microtime(true) - $startG;
$startG = microtime(true);
if (CustomizeUser::canDownloadVideosFromVideo($value['id'])) {
@$timesG[__LINE__] += microtime(true) - $startG;
$startG = microtime(true);
$files = getVideosURL($value['filename']);
@$timesG[__LINE__] += microtime(true) - $startG;
$startG = microtime(true);
if (!(!empty($files['m3u8']) && empty($files['mp4']))) {
?>
<div style="position: relative; overflow: visible; z-index: 3;" class="dropup">
<button type="button" class="btn btn-default btn-sm btn-xs btn-block" data-toggle="dropdown">
<i class="fa fa-download"></i> <?php echo!empty($advancedCustom->uploadButtonDropdownText) ? $advancedCustom->uploadButtonDropdownText : ""; ?> <span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-left" role="menu">
<?php
//var_dump($files);exit;
foreach ($files as $key => $theLink) {
if (($theLink['type'] !== 'video' && $theLink['type'] !== 'audio') || $key == "m3u8") {
continue;
}
$path_parts = pathinfo($theLink['filename']);
?>
<li>
<a href="<?php echo $theLink['url']; ?>?download=1&title=<?php echo urlencode($value['title'] . "_{$key}_.{$path_parts['extension']}"); ?>">
<?php echo __("Download"); ?> <?php echo $key; ?>
</a>
</li>
<?php }
?>
</ul>
</div>
<?php
}
}
@$timesG[__LINE__] += microtime(true) - $startG;
$startG = microtime(true);
getLdJson($value['id']);
getItemprop($value['id']);
?>
</div>
<!--
createGallerySection
<?php
$timesG[__LINE__] = microtime(true) - $startG;
$startG = microtime(true);
foreach ($timesG as $key => $value) {
echo "Line: {$key} -> {$value}\n";
}
?>
-->
<?php
unset($_POST['disableAddTo']);
}
?>
<div class="col-xs-12 text-center clear clearfix" style="padding: 10px;">
<?php echo getAdsLeaderBoardMiddle(); ?>
</div>
<!--
createGallerySection
<?php
$timesG[__LINE__] = microtime(true) - $startG;
$startG = microtime(true);
foreach ($timesG as $key => $value) {
echo "Line: {$key
} -> {$value
}\n";
}
?>
-->
<?php
unset($_POST['disableAddTo']);
}
function createChannelItem($users_id, $photoURL = "", $identification = "", $rowCount = 12) {
$total = Video::getTotalVideos("viewable", $users_id);
if (empty($total)) {
return false;
}
if (empty($photoURL)) {
$photoURL = User::getPhoto($users_id);
}
if (empty($identification)) {
$identification = User::getNameIdentificationById($users_id);
}
?>
<div class="clear clearfix">
<h3 class="galleryTitle">
<img src="<?php
echo $photoURL;
?>" class="img img-circle img-responsive pull-left" style="max-height: 20px;">
<span style="margin: 0 5px;">
<?php
echo $identification;
?>
</span>
<a class="btn btn-xs btn-default" href="<?php echo User::getChannelLink($users_id); ?>" style="margin: 0 10px;">
<i class="fas fa-external-link-alt"></i>
</a>
<?php
echo Subscribe::getButton($users_id);
?>
</h3>
<div class="row">
<?php
$countCols = 0;
unset($_POST['sort']);
$_POST['sort']['created'] = "DESC";
$_POST['current'] = 1;
$_POST['rowCount'] = $rowCount;
$videos = Video::getAllVideos("viewable", $users_id);
createGallerySection($videos);
?>
</div>
</div>
$total = Video::getTotalVideos("viewable", $users_id);
if (empty($total)) {
return false;
}
if (empty($photoURL)) {
$photoURL = User::getPhoto($users_id);
}
if (empty($identification)) {
$identification = User::getNameIdentificationById($users_id);
}
?>
<div class="clear clearfix">
<h3 class="galleryTitle">
<img src="<?php
echo $photoURL;
?>" class="img img-circle img-responsive pull-left" style="max-height: 20px;">
<span style="margin: 0 5px;">
<?php
echo $identification;
?>
</span>
<a class="btn btn-xs btn-default" href="<?php echo User::getChannelLink($users_id); ?>" style="margin: 0 10px;">
<i class="fas fa-external-link-alt"></i>
</a>
<?php
echo Subscribe::getButton($users_id);
?>
</h3>
<div class="row">
<?php
$countCols = 0;
unset($_POST['sort']);
$_POST['sort']['created'] = "DESC";
$_POST['current'] = 1;
$_POST['rowCount'] = $rowCount;
$videos = Video::getAllVideos("viewable", $users_id);
createGallerySection($videos);
?>
</div>
</div>
<?php
}
$search = "";
$searchPhrase = "";
function clearSearch() {
global $search, $searchPhrase;
$search = $_GET['search'];
$searchPhrase = $_POST['searchPhrase'];
unset($_GET['search']);
unset($_POST['searchPhrase']);
global $search, $searchPhrase;
$search = $_GET['search'];
$searchPhrase = $_POST['searchPhrase'];
unset($_GET['search']);
unset($_POST['searchPhrase']);
}
function reloadSearch() {
global $search, $searchPhrase;
$_GET['search'] = $search;
$_POST['searchPhrase'] = $searchPhrase;
global $search, $searchPhrase;
$_GET['search'] = $search;
$_POST['searchPhrase'] = $searchPhrase;
}
?>

View file

@ -348,6 +348,12 @@ abstract class PluginAbstract {
return 0;
}
/**
*
* @param type $users_id
* @param type $videos_id
* @return 0 = I dont know, -1 = can not watch, 1 = can watch
*/
public function userCanWatchVideoWithAds($users_id, $videos_id) {
return 0;
}

View file

@ -0,0 +1,12 @@
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
ALTER TABLE `videos`
ADD COLUMN `video_password` VARCHAR(45) NULL DEFAULT NULL;
UPDATE configurations SET version = '8.3', modified = now() WHERE id = 1;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;