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

Banner in channels clickable link

add the Website URL field on the profile and use it as a link for the channel banner
Add more info on the database regarding video publishing and notifications
This commit is contained in:
DanieL 2022-11-09 11:10:23 -03:00
parent 4c145533a3
commit 90e0facdcf
9 changed files with 171 additions and 54 deletions

View file

@ -4,7 +4,7 @@ if (file_exists("../videos/configuration.php")) {
exit;
}
$installationVersion = "12.1";
$installationVersion = "12.2";
error_log("Installation: ".__LINE__." ". json_encode($_POST));
header('Content-Type: application/json');

View file

@ -131,34 +131,31 @@ CREATE TABLE IF NOT EXISTS `sites` (
PRIMARY KEY (`id`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `videos`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `videos` (
`id` INT NOT NULL AUTO_INCREMENT,
`id` INT(11) NOT NULL AUTO_INCREMENT,
`title` VARCHAR(190) NOT NULL,
`clean_title` VARCHAR(190) NOT NULL,
`description` TEXT NULL,
`views_count` INT NOT NULL DEFAULT 0,
`description` TEXT NULL DEFAULT NULL,
`views_count` INT(11) NOT NULL DEFAULT 0,
`views_count_25` INT(11) NULL DEFAULT 0,
`views_count_50` INT(11) NULL DEFAULT 0,
`views_count_75` INT(11) NULL DEFAULT 0,
`views_count_100` INT(11) NULL DEFAULT 0,
`status` VARCHAR(16) NOT NULL DEFAULT 'e' ,
`status` VARCHAR(16) NOT NULL DEFAULT 'e',
`created` DATETIME NOT NULL,
`modified` DATETIME NOT NULL,
`users_id` INT NOT NULL,
`categories_id` INT NOT NULL,
`users_id` INT(11) NOT NULL,
`categories_id` INT(11) NOT NULL,
`filename` VARCHAR(255) NOT NULL,
`duration` VARCHAR(15) NOT NULL,
`type` ENUM('audio', 'video', 'embed', 'linkVideo', 'linkAudio', 'torrent', 'pdf', 'image', 'gallery', 'article', 'serie', 'zip') NOT NULL DEFAULT 'video',
`videoDownloadedLink` VARCHAR(255) NULL,
`order` INT UNSIGNED NOT NULL DEFAULT 1,
`rotation` SMALLINT NULL DEFAULT 0,
`videoDownloadedLink` VARCHAR(255) NULL DEFAULT NULL,
`order` INT(10) UNSIGNED NOT NULL DEFAULT 1,
`rotation` SMALLINT(6) NULL DEFAULT 0,
`zoom` FLOAT NULL DEFAULT 1,
`youtubeId` VARCHAR(45) NULL,
`videoLink` TEXT NULL,
`next_videos_id` INT NULL,
`youtubeId` VARCHAR(45) NULL DEFAULT NULL,
`videoLink` TEXT NULL DEFAULT NULL,
`next_videos_id` INT(11) NULL DEFAULT NULL,
`isSuggested` INT(1) NOT NULL DEFAULT 0,
`trailer1` VARCHAR(255) NULL DEFAULT NULL,
`trailer2` VARCHAR(255) NULL DEFAULT NULL,
@ -170,37 +167,56 @@ CREATE TABLE IF NOT EXISTS `videos` (
`externalOptions` TEXT NULL DEFAULT NULL,
`only_for_paid` TINYINT(1) NULL DEFAULT NULL,
`serie_playlists_id` INT(11) NULL DEFAULT NULL,
`sites_id` INT(11) NULL,
`sites_id` INT(11) NULL DEFAULT NULL,
`video_password` VARCHAR(45) NULL DEFAULT NULL,
`encoderURL` VARCHAR(255) NULL DEFAULT NULL,
`filepath` VARCHAR(255) NULL DEFAULT NULL,
`filesize` BIGINT(19) UNSIGNED NULL DEFAULT 0,
`live_transmitions_history_id` INT(11) NULL DEFAULT NULL,
`total_seconds_watching` INT(11) NULL DEFAULT 0,
`duration_in_seconds` INT NULL DEFAULT NULL,
`likes` INT(11) NULL DEFAULT NULL,
`dislikes` INT(11) NULL DEFAULT NULL,
`users_id_company` INT(11) NULL DEFAULT NULL,
`epg_link` VARCHAR(400) NULL DEFAULT NULL,
`total_seconds_watching` INT NULL DEFAULT 0,
`duration_in_seconds` INT NULL,
`likes` INT NULL,
`dislikes` INT NULL,
`users_id_company` INT(11) NULL,
`epg_link` VARCHAR(400) NULL,
`publish_datetime` DATETIME NULL,
`notification_datetime` DATETIME NULL,
PRIMARY KEY (`id`),
INDEX `fk_videos_users1_idx` (`users_id_company` ASC),
UNIQUE INDEX `clean_title_UNIQUE` (`clean_title` ASC),
INDEX `fk_videos_users_idx` (`users_id` ASC),
INDEX `fk_videos_categories1_idx` (`categories_id` ASC),
UNIQUE INDEX `clean_title_UNIQUE` (`clean_title` ASC),
INDEX `index5` (`order` ASC),
INDEX `fk_videos_videos1_idx` (`next_videos_id` ASC),
INDEX `fk_videos_sites1_idx` (`sites_id` ASC),
INDEX `clean_title_INDEX` (`clean_title` ASC),
INDEX `video_filename_INDEX` (`filename` ASC),
INDEX `video_status_idx` (`status` ASC),
INDEX `video_type_idx` (`type` ASC) ,
INDEX `videos_likes_index` (`likes` ASC),
INDEX `videos_dislikes_index` (`dislikes` ASC),
INDEX `video_type_idx` (`type` ASC),
INDEX `fk_videos_playlists1` (`serie_playlists_id` ASC),
INDEX `videos_status_index` (`status` ASC),
INDEX `is_suggested_index` (`isSuggested` ASC),
INDEX `views_count_index` (`views_count` ASC),
INDEX `filename_index` (`filename` ASC),
INDEX `fk_videos_live_transmitions_history1_idx` (`live_transmitions_history_id` ASC),
INDEX `total_sec_watchinindex` (`total_seconds_watching` ASC),
INDEX `index_epg_link` (`epg_link` ASC),
FULLTEXT INDEX `index17vname` (`title`),
FULLTEXT INDEX `index18vdesc` (`description`),
INDEX `total_sec_watchinindex` (`total_seconds_watching` ASC),
INDEX `videos_likes_index` (`likes` ASC),
INDEX `videos_dislikes_index` (`dislikes` ASC),
INDEX `fk_videos_users1_idx` (`users_id_company` ASC),
INDEX `index_epg_link` (`epg_link` ASC),
INDEX `index25_publish` (`publish_datetime` ASC),
INDEX `index26_publish` (`notification_datetime` ASC),
CONSTRAINT `fk_videos_categories1`
FOREIGN KEY (`categories_id`)
REFERENCES `categories` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_videos_playlists1`
FOREIGN KEY (`serie_playlists_id`)
REFERENCES `playlists` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `fk_videos_sites1`
FOREIGN KEY (`sites_id`)
REFERENCES `sites` (`id`)
@ -211,26 +227,16 @@ CREATE TABLE IF NOT EXISTS `videos` (
REFERENCES `users` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_videos_categories1`
FOREIGN KEY (`categories_id`)
REFERENCES `categories` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_videos_videos1`
FOREIGN KEY (`next_videos_id`)
REFERENCES `videos` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_videos_playlists1`
FOREIGN KEY (`serie_playlists_id`)
REFERENCES `playlists` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `fk_videos_users1`
FOREIGN KEY (`users_id_company`)
REFERENCES `users` (`id`)
ON DELETE SET NULL
ON UPDATE SET NULL)
CONSTRAINT `fk_videos_users1`
FOREIGN KEY (`users_id_company`)
REFERENCES `users` (`id`)
ON DELETE SET NULL
ON UPDATE SET NULL)
ENGINE = InnoDB;
CREATE TABLE IF NOT EXISTS `videos_metadata` (

View file

@ -917,6 +917,7 @@ if (typeof gtag !== \"function\") {
if (!empty($this->id)) {
$arrayTables = array(
//'live_transmition_history_log',
'live_transmitions',
'users_login_history',
'audit',
@ -2829,16 +2830,34 @@ if (typeof gtag !== \"function\") {
return $user->addExternalOptions('ExtraSubscribers', intval($value));
}
public static function getProfilePassword($users_id) {
public static function getProfilePassword($users_id='') {
global $config;
$obj = AVideoPlugin::getObjectDataIfEnabled("CustomizeUser");
if (empty($obj)) {
return false;
}
if(empty($users_id)){
$users_id = User::getId();
}
$user = new User($users_id);
$value = $user->getExternalOptions('ProfilePassword');
return $value;
}
public static function getWebsite($users_id='') {
global $config;
$obj = AVideoPlugin::getObjectDataIfEnabled("CustomizeUser");
if (empty($obj)) {
return false;
}
if(empty($users_id)){
$users_id = User::getId();
}
$user = new User($users_id);
$value = $user->getExternalOptions('userWebsite');
return $value;
}
public static function setProfilePassword($users_id, $value) {
$obj = AVideoPlugin::getObjectDataIfEnabled("CustomizeUser");
@ -2849,9 +2868,12 @@ if (typeof gtag !== \"function\") {
return $user->addExternalOptions('ProfilePassword', preg_replace('/[^0-9a-z]/i', '', $value));
}
public static function getDonationButtons($users_id) {
public static function getDonationButtons($users_id='') {
global $config;
$obj = AVideoPlugin::getObjectDataIfEnabled("CustomizeUser");
if(empty($users_id)){
$users_id = User::getId();
}
if (empty($obj) || empty($users_id)) {
return false;
}

View file

@ -3432,6 +3432,7 @@ if (!class_exists('Video')) {
$source['url'] = addQueryStringParameter($source['url'], 'cache', $x);
$source['url_noCDN'] = addQueryStringParameter($source['url_noCDN'], 'cache', $x);
}
//var_dump($source);exit;
//ObjectYPT::setCache($name, $source);
$VideoGetSourceFile[$cacheName] = $source;
return $VideoGetSourceFile[$cacheName];

View file

@ -174,7 +174,7 @@ class CustomizeUser extends PluginAbstract {
return $obj;
}
static function getCallerButton($users_id, $class = '') {
global $global;
$users_id = intval($users_id);
@ -299,6 +299,7 @@ class CustomizeUser extends PluginAbstract {
}
public function getMyAccount($users_id) {
global $global;
$objcu = AVideoPlugin::getObjectDataIfEnabled("CustomizeUser");
if (!empty($objcu) && !empty($objcu->userCanAllowFilesDownload)) {
@ -315,6 +316,8 @@ class CustomizeUser extends PluginAbstract {
self::getSwitchUserCanAllowFilesShare($users_id);
echo '</div></div>';
}
include $global['systemRootPath'] . 'plugin/CustomizeUser/getMyAccount.php';
}
public function getChannelButton() {

View file

@ -0,0 +1,41 @@
<?php
if (User::canUpload()) {
?>
<div class="form-group">
<label class="col-md-4 control-label">
<?php echo __("Website"); ?>
</label>
<div class="col-md-8 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="fas fa-globe"></i></span>
<input id="userWebsite" placeholder="<?php echo __("Website"); ?>" class="form-control" type="url" value="<?php echo User::getWebsite(); ?>">
</div>
</div>
</div>
<script>
$(document).ready(function () {
$('#userWebsite').change(function (e) {
saveUserSite();
});
});
function saveUserSite() {
var userWebsite = $('#userWebsite').val();
if(empty(userWebsite) || validURL(userWebsite)){
modal.showPleaseWait();
$.ajax({
url: webSiteRootURL + 'plugin/CustomizeUser/getMyAccount.save.json.php',
data: {userWebsite: userWebsite},
type: 'post',
success: function (response) {
avideoResponse(response);
modal.hidePleaseWait();
}
});
}
}
</script>
<?php
}
?>

View file

@ -0,0 +1,27 @@
<?php
require_once '../../videos/configuration.php';
session_write_close();
header('Content-Type: application/json');
$obj = new stdClass();
$obj->error = true;
$obj->msg = "";
if(!User::canUpload()){
$obj->msg = "Cannot Upload";
die(json_encode($obj));
}
$userWebsite = preg_replace('/[^a-z0-9_\/@.:?&=;%-]/i', '', @$_POST['userWebsite']);
if(!empty($userWebsite) && !isValidURL($userWebsite)){
$obj->msg = "User Site is invalid {$_POST['userWebsite']} = {$userWebsite}";
die(json_encode($obj));
}
$cobj = AVideoPlugin::getObjectData("CustomizeUser");
$user = new User(User::getId());
$obj->added = $user->addExternalOptions('userWebsite', $userWebsite);
$obj->error = empty($obj->added);
die(json_encode($obj));

View file

@ -0,0 +1,15 @@
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 `publish_datetime` DATETIME NULL DEFAULT NULL,
ADD COLUMN `notification_datetime` DATETIME NULL DEFAULT NULL,
ADD INDEX `index25_publish` (`publish_datetime` ASC),
ADD INDEX `index26_publish` (`notification_datetime` ASC);
UPDATE configurations SET version = '12.2', 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;

View file

@ -132,12 +132,14 @@ $obj = AVideoPlugin::getObjectData("YouPHPFlix2");
}
?>
<div class="clearfix" style="clear: both;"></div>
<div class="row bg-info profileBg" style="margin: 20px -10px; background: url('<?php echo getURL($relativePath); ?>') no-repeat 50% 50%; -webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;">
<img src="<?php echo User::getPhoto($user_id); ?>" alt="<?php echo $user->_getName(); ?>" class="img img-responsive img-thumbnail" style="max-width: 100px;"/>
</div>
<a href="<?php echo User::getWebsite($user_id); ?>" target="_blank">
<div class="row bg-info profileBg" style="margin: 20px -10px; background: url('<?php echo getURL($relativePath); ?>') no-repeat 50% 50%; -webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;">
<img src="<?php echo User::getPhoto($user_id); ?>" alt="<?php echo $user->_getName(); ?>" class="img img-responsive img-thumbnail" style="max-width: 100px;"/>
</div>
</a>
<?php
}
?>